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
In reply to Re: Key, newline, value problem
by Happy-the-monk
in thread Key, newline, value problem
by ciryon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |