Blunder matches on the under at the end of the string. If you want to match only under
m/^under$/
Chris D. Garringer
LAN/WAN Manager
Master Certified Netware Engineer
Microsoft Certified Systems Engineer
Certified Solaris Administrator
Red Hat Certified Engineer
[EMAIL PROTECTED]
fax 713-896-5266
>>> "Sudarsan.Raghavan" <[EMAIL PROTECTED]> 07/27/01 05:15PM >>>
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]