Scripting >> Perl >> How to read arguments from the command line

 

<br /> use File::Basename; <br /> <br /> $prog = basename(replacebegin:content:replaceend); <br /> if($#ARGV &amp;lt; 0) <br /> { <br /> die &quot;\nUsage: $prog [options]&quot;; <br /> } <br /> foreach $arg (@ARGV) <br /> { <br /> print &quot;$arg\n&quot;; <br /> } <br /> <br /> # eg. use first argument as $computer $computer = $ARGV[0];