On Sep 2, Tom Allison said:
foreach ( $string =~ /([\w\s]+):([\w\s]+)/g ) {
...
}
But I always get only the last pair... I thought the /g would stop that
behaviour..
You're mixing 'foreach' with /.../g, and the results aren't what you'll
expect. Instead, use 'while':
while ($str =~ /([\w\s]+):([\w\s]+)/g) {
my ($k, $v) = ($1, $2);
# ...
}
--
Jeff "japhy" Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ % -- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>