Array and printing the varible

Hi,
array={mb_pkt.rsvd_dw2_b4, mb_pkt.rsvd_dw5_b19, mb_pkt.rsvd_dw6_b23, mb_pkt.rsvd_dw6_b22, mb_pkt.rsvd_dw6_b21};
foreach(array[i])
if(array[i]>0)
`uvm_info(“CHECK_RESERVED”, $sformatf(“reservd field with non zero value : reserved filed=%0h”,array[i]),UVM_DEBUG)

here whenever i=0, i want to print the name mb_pkt.rsvd_dw2_b4 and if i is 2 i want to print the name mb_pkt.rsvd_dw5_b19 and so on the given array.
i hope you got it? can anyone help me this.

'Thanks
abhishek

In reply to abhi.khati7274:

You can create an array os string names

const string names[] ={"mb_pkt.rsvd_dw2_b4", "mb_pkt.rsvd_dw5_b19", "mb_pkt.rsvd_dw6_b23", "mb_pkt.rsvd_dw6_b22", "mb_pkt.rsvd_dw6_b21"};

Then
names[i]
gives you the string names you requested.

In reply to dave_59:

hi , where should i put const string names ={“mb_pkt.rsvd_dw2_b4”, “mb_pkt.rsvd_dw5_b19”, “mb_pkt.rsvd_dw6_b23”, “mb_pkt.rsvd_dw6_b22”, “mb_pkt.rsvd_dw6_b21”}; in the above code,
in the array[i], lets say whenever i=2 it should give mb_pkt.rsvd_dw6_b23.