# With Perl's -s switch $ ./anWithArgs.pl -type=letters input.txt $ cat anWithArgs.pl #!/usr/bin/perl -sn if ( $type eq 'letters' ) { print if /[[:alpha:]]/; } elsif ( $type eq 'numbers' ) { print if /\d/; } else { print "bad type: $type" }