Using shift to process the command-line arguments.
#!/usr/local/bin/perl while (1) { $currarg = shift; last if (!defined($currarg)); print ("$currarg\n"); }