← All Articles

How to Read Program Arguments in Perl

Posted on

IISResetMe has made another Program Arguments script. This time in perl. Reading perl has always been weird for me. I have never used perl for much myself - but I have written a lot of php and a lot of ruby - and it shows where they have borrowed many of their ideas.

$argn = $#ARGV + 1;
if($argn < 2){
  print "Usage: perl $0 name [name] [name] [name]\n";

foreach my $name (@ARGV) {
  print "Hello $name";