Perl Shell - A Solution

#!/usr/local/bin/perl -s

The -s on this invocation line tells Perl to search the command line for switches. Any switches that it finds are removed from @ARGV and their correspondingly named scalar variables are set true.

For example if we invoked our program as

    psh -p
@ARGV is empty and within psh a variable $p is set true.