in reply to Key, newline, value problem
use the /s (or /m) and /g modifiers to treat the string as a single line (or as multiple lines) and get multiple matches:
my @matches =~ m/(\S+)\s+(\d+)/mg; # or /sg
if ( @matches ) { ...
Update: even better using a hash:
my %matches =~ m/(\S+)\s+(\d+)/sg; # or /mg
foreach ( keys %matches ) { ...
Update 2: Added small print /s ( + /m ) ambiguity...
See perldoc perlre for more info on perl regular expressions and those and other flags.
Cheers, Sören
|
|---|