not really... =~ indicates the match should be on the var on the LHS of the
operator.. in this case, $strip.
however, $strip is the variable where he wants the word chars STORED that
are in $_ (implicitly set from the while loop),
not the variable he wishes to match on. Furthermore, to capture, yo
you want that to be:
$strip =~ /\w+/; #??
see the ~ thingie
-Original Message-
I'm running perl version 5.005_03 and I have a simple
match and capture that I can't seem to get to work.
while () {
$strip = /\w+/;
print "$strip \n";
}
This just returns to me
On Jul 13, Tom Dubs said:
>while () {
>
>$strip = /\w+/;
>print "$strip \n";
>}
A regular expression in scalar context returns true or false. If you want
to get at a specific part of the match, you need to:
1. use capturing parentheses, and
2a. use list context, OR
2b. us
I'm running perl version 5.005_03 and I have a simple
match and capture that I can't seem to get to work.
while () {
$strip = /\w+/;
print "$strip \n";
}
This just returns to me a 1. Which makes sense to an
extent, for if the match is found then it will return
a 1 for "true". Bu