$file = '0.000000e+000 1.502947e+000 1.162272e-012 1.508957e+001 2.324544e-012 1.508948e+000'; my $regex = { 'first' => qr{^(\S+)}, # anything non-blank from the beginning '^' 'second' => qr{\s+(\S*)} # anything non-blank after the fist blank '\ +s+' }; for(split '\n', $file){ /$regex->{first}$regex->{second}/o # 'o' compiles the regex and # and upon success we take the first column and/or the second one print "Key: $1 and Value: $2\n"; # So hash structure can have $hash{$1} = $2 }
In reply to Re: how to place rows information into column (2)
by sh1tn
in thread how to place rows information into column?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |