I have a quite annoying problem here for which I found a workaround already but would rather like to see why this is happening, so I'm asking here :-)
I have a loop around a match, which looks like the following:
The problem is that $1 is always the first match. When I use $_ in this loop I get the thing I want - each new match in each iteration of the loop. I also tried it with a while loop but that one seems to go forever and also just displays the first match also like within the for loop with $1...use LWP::UserAgent; # request in here for ($res->content =~ m/foo(.*?)bar/g) { print "$_ - $1\n"; }
/me is totally confused.
--
Alfie
In reply to $1 doesn't reset? by alfie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |