All,
This may be a stupid question. I was going through some online perl
tutorials and they say that $_ is the default input, output and pattern
matching variable.
I tried this out
[suddy@incq231e hash]$ perl
<STDIN>;
if (m/under/) {
print "Found Under\n";
}
else {
print "No Match\n";
}
under
No Match
When I tried with <STDIN> inside while
[suddy@incq231e hash]$ perl
while (<STDIN>) {
if (m/under/) {
print "Found Under\n";
}
else {
print "No Match\n";
}
}
under
Found Under
blunder
Found Under
boom
No Match
What is the reason for this difference in behavior.
Thanks,
Sudarsan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]