our $type; BEGIN { $type ||= shift or die "no type"; } #### #!/usr/bin/perl -an our $type; BEGIN { $type ||= shift or die "no type"; } if ( $type eq 'letters' ) { print if $_ =~ /[[:alpha:]]/; } elsif ( $type eq 'numbers' ) { print if $_ =~ /\d/; } else { print "bad type: $type" }