in reply to Re: pos()atively mysterious.
in thread pos()atively mysterious.
Erm. That doesn't help. The following program produces exactly the same errors?
my $str = 'the quick brown fox'; while( $str =~ m/(.)/g) { print "Matched '$1' \@ pos:", pos(); }
I'm not sure why you thought that use a variable rather than a constant would change anything as I am not attempting to modify the data in anyway, I'm just printing the char captured (successfully) and the position at which it was found (unsuccessfully).
Basically, the pos() function is never returning anything but undef, despite the fact that the m//g is obviously remembering the last position matched as it print each successive char on subsequent iterations.
Examine what is said, not who speaks.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: pos()atively mysterious.
by rob_au (Abbot) on Dec 16, 2002 at 10:52 UTC | |
by BrowserUk (Patriarch) on Dec 16, 2002 at 11:01 UTC |
In Section
Seekers of Perl Wisdom