Um pequeno script que pode ajudar iniciantes a tentar construir programas de linha de comando em Perl:

use List::Util qw(first);

foreach $arg (@ARGV) {
$_
= $arg;
if (/^-/)
{
print "$arg is an invocation optionn";
#Eliminate invocation options from @ARGV before we run the <> operator
splice
@ARGV, first { @ARGV[$_] eq $arg } 0..$#ARGV, -1;
}
}

while (<>) {
chomp
;
print "It was $_ that I sawn";
}