How to create the queue array of class from text file

In reply to chr_sue:

I am trying to write the scoreboard code for register wr-rd.

Actual data comes from monitor through uvm_analysis_port.

virtual function void write(svci_rsp_trans_pkt read_rsp);
   `uvm_info("SVCI_MSTR_SEQ","Received read response" , UVM_LOW)
    $display(" vif_rdata = 0x%0x " ,read_rsp.rsp_rdata);
        uvm_info("SCB", $sformatf("Seq_item written from monitor: \n"), UVM_LOW)
        read_rsp.print();
      
        // push captured seq_item into queue
        rcvd_seq_item_q.push_back(read_rsp);
  
  endfunction

Expected data :

task get_all_regs();
  begin
       svci_reg_ svci_reg_h;
        bit [31:0]  addr_;
        bit [63:0]  wdata_; //default data @reset
        bit [63:0]  rdata_; //exp rdata
        bit [63:0]  rmask_; //exp rdata
        bit [63:0]  wmask_; //exp rdata
        int fd;
        int i = 0;
    //call the perl script to parse the ralf file to update queues
    $display ("perl exe");
    $system(" perl /home/rupeshg/REG_SFRtop/datatxtgen.pl  /home/rupeshg/REG_SFRtop/sfr_top_defines.h ");
    fd = $fopen ("data.txt" , "r");
    while ($fscanf (fd, "%0h %0h %0h %0h %h", addr_, wdata_, wmask_, rmask_, rdata_) == 5) begin
 
        svci_reg_h  = new ;
        svci_reg_h.addr = addr_;
        svci_reg_h.wdata = wdata_;
        svci_reg_h.wr_mask = wmask_;
        svci_reg_h.rd_mask = rmask_ ;
        svci_reg_h.rdata = rdata_ ;
         //$display ("addr_ %h , data_ %h wmask_ %h , rmask_ %h",p1.addr, p1.data, p1.wmask, p1.rmask);
         wr_rd_reg_addr_array_q.push_back(svci_reg_h);
	 $display("qu size = %0d", wr_rd_reg_addr_array_q.size);
  end
    $fclose(fd);
         foreach (wr_rd_reg_addr_array_q[i])
           begin
             $display ("queue of class [%0d] = %h , %h, %h , %h, READ_DATA = %h ", i , wr_rd_reg_addr_array_q[i].addr, wr_rd_reg_addr_array_q[i].wdata, wr_rd_reg_addr_array_q[i].wr_mask,  wr_rd_reg_addr_array_q[i].rd_mask, wr_rd_reg_addr_array_q[i].rdata);
 
          end
  end
 
  endtask 

Collecting the expected data and actual data :-

virtual task run_phase(uvm_phase phase);
    begin
   // phase.raise_objection(this);
     svci_reg_  exp_pkt ;

     svci_rsp_trans_pkt rcvd_pkt ; 
        //super.run_phase(phase);
      $display ("I am inside scoreboard");
     get_all_regs(); //to do    
        forever begin
            wait(wr_rd_reg_addr_array_q.size() !=0 && rcvd_seq_item_q.size() !=0);
            $display ("I am inside wait");
                exp_pkt = wr_rd_reg_addr_array_q.pop_front();
                rcvd_pkt = rcvd_seq_item_q.pop_front();
                $display("exp_pkt = %p",rcvd_seq_item_q.pop_front() );
                compare_pkt(exp_pkt, rcvd_pkt);                
        end  
     end 
    endtask: run_phase

Compare :-

function void compare_pkt(input svci_reg_ exp_pkt, svci_rsp_trans_pkt  rcvd_pkt);
      if(exp_pkt.ADDR == rcvd_pkt.ADDR) begin
            if(exp_pkt.DATA != rcvd_pkt.DATA) begin
               `uvm_error("DATA MISMATCH ERROR", $sformatf("SCB:: For ADDR: %0h Expecting DATA:%0h but Received DATA: %0h", exp_pkt.ADDR, exp_pkt.DATA, rcvd_pkt.DATA))
         end
      end
      else begin
          `uvm_error("ADDR MISMATCH ERROR", $sformatf("SCB:: Expected ADDR:%0h But received ADDR: %0h", exp_pkt.ADDR, rcvd_pkt.ADDR))      end
    endfunction: compare_pkt

Could anyone suggest me, is it correct or am i missing anything ?