Hi All,
How do I use // except with a variable in a script and not a pipe and a one liner?
echo -e "abc\ndef\nghi\n" | perl -wlne '! /def/ and print "$_";'abc ghi
But I am having a hard time figuring out how to do it in a full script. How do I use // in a full script?
#!/usr/bin/perl use strict; use warnings; use diagnostics; my $A="abc\ndef\nghi\n"; (my $B = $A ) =~ ! /def/; print "$B";
Use of uninitialized value $_ in pattern match (m//) at ./ExtractTest.pl line 8 (#1
What am I doing wrong
Many Thanks, -T
In reply to Regex match on implicit default variable ($_) in a script, not a one liner by Todd Chester
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |