kasi ramanathen wrote:
> $t="perl";
> while($ln=~m/$t/g)
> {
> print "it matches..";
> }
>
Hi Kasi,
The part above shoul;d work, because this does:
#!/usr/bin/perl -w
use strict;
my $Test = "Hi";
my $Greeting = "Hi, there. How are you?";
if ($Greeting =~ /$Test/) {
print "$Greeting\n";
} else {
print "Nope\n";
}
I can assure you that the problem lies elswhere than whether variables interpolate
within regeses--they do. I would strongly suggest that you heed Robs advice about
using whitespace in your code. What you cannot see, you cannot debug.
Try printing out the string [$ln] you are examining before testing it with the regex.
Is the test string actually there? Exactly as assigned to the variable (since you
used the global g modifier, but not the case-insensitive i?
Look throough your code again, because the problem lies elsewhere. Whatever is in $t
is not being found in $ln.
Joseph
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]