I have a string that I would like to put into a hash.
0,"104"1,"Assign Tracking Numb"29,"905745371116"526,"0201"99,""
The string is setup like the following:
Code,"data".
The code is always numeric.
The desired output is similiar to following:
%rec = (
0 => 104,
1 => 'Assign Tracking Numb',
29 => 905745371116,
526 => 0201,
99 => ,
);
The regex needs to be change to something else.
/((\d*),"\w*")/gm;
$result = "0,\"104\"1,\"Assign Tracking Numb\"29,\"905745371116\"526,\
+"0201\"99,\"\"";
%row = $result =~ /((\d*),"\w*")/gm;
use Data::Dumper;
print Dumper(%row);
foreach $key (keys (%row) ) {
print $key ."\n";
}
Output (Not what I want)
$VAR1 = '0,"104"';
$VAR2 = '0';
$VAR3 = '29,"905745371116"';
$VAR4 = '29';
$VAR5 = '526,"0201"';
$VAR6 = '526';
$VAR7 = '99,""';
$VAR8 = '99';
0,"104"
29,"905745371116"
526,"0201"
99,""