$cat input.txt | ./anWithArgs.pl letters # should spit out lines with a letter Can't open letters: Datei oder Verzeichnis nicht gefunden. $cat input.txt | ./anWithArgs.pl numbers # should spit out lines with a number Can't open numbers: Datei oder Verzeichnis nicht gefunden. $cat anWithArgs.pl #!/usr/bin/perl -an my $type = shift or die "no type"; if ( $type eq 'letters' ) { print if $_ =~ /\w/; } elsif ( $type eq 'numbers' ) { print if $_ =~ /\d/; } else { print "bad type: $type" } $cat input.txt a b c d e f g 1 2 3 4 5 6 7 8 9