I want to have such pipe in bash
#! /usr/bin/bash
cut -f1,2 file1.txt | myperl.pl foo | sort -u
Now in myperl.pl
it has content like this
my $argv = $ARG[0] || "foo";
while (<>) {
chomp;
if ($argv eq "foo") {
# do something with $_
}
else {
# do another
}
}
But why the Perl script can't recognize the parameter passed through bash? Namely the code break with this message:
Can't open foo: No such file or directory at myperl.pl line 15.
What the right way to do it so that my Perl script can receive standard input and parameter at the same time?