compares "def" with $_ .! /def/
$_ is defined in your one-liner (By the existance of -n in the perl command)
But $_ is undefined in the "full script".
Perhaps you meant:
which compares the contents of $A/$B.(my $B = $A ) !~ /def/ and print $B;
The best defense against logic is ignorance.
In reply to Re: Regex match on implicit default variable ($_) in a script, not a one liner
by NetWallah
in thread Regex match on implicit default variable ($_) in a script, not a one liner
by Todd Chester
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |