-1
I am giving some maintenance on a system in Perl (language that I am Noob) and I needed to create a new report module where I need to solve the following situation:
I have 2 arrays with the following formats
@head = ("nomeinstituicao", "cnpjinstituicao","nomecliente", "cnpjcliente", "notacliente" );
@data = ("inst1", "12345678000112","joao",
"87654321000198","5","inst2","54387612000123","maria","45612387000123","6",...);
I need to produce a hash in the following format:
%hash = (
"nomeinstituicao" => "inst1",
"cnpjinstituicao" => "12345678000112",
"nomecliente" => "joao",
"cnpjcliente" => "87654321000198",
"notacliente" => "5",
"nomeinstituicao" => "inst2",
"cnpjinstituicao" => "54387612000123",
"nomecliente" => "maria",
"cnpjcliente" => "45612387000123",
"notacliente" => "6",
...
);
Could someone help me with a way to make this transformation dynamically taking into account that data contained in $data
I’m looking in the comic book.
I’ve been trying all day and I haven’t been able to so far, I’ve tried with map
and with while
but I guess I’m not doing it right.