
osmodius
Novice
Apr 21, 2007, 4:02 PM
Post #2 of 6
(9456 views)
|
Re: [PGScooter] storing matches
[In reply to]
|
Can't Post
|
|
Well, in response to your first question - why do they not work? It's because in a scalar context, the match operator (m//) will return true or false, and NOT the string that triggered the match. The following code will work,
if($definition =~ m/(Pronunciation\[*\])/){ $pronunciation = $1; } And for the second question - why does it not work? Because the substitute operator (s///) returns the number of strings substituted, and not the strings that were substituted. To get around this, you can do the following:
while($definition =~ s/(Pronunciation\[*\])/OUT/g){ push(@pronunciation, $1); } Need some real-time help? Shove admin@ub3r.net on yer MSN.
|