Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    GetOptions("luckynumber=i" => \$luckynumber) or die("GetOptions failed
    +");
    die "missing argument luckynumber" unless defined($luckynumber);
    print "Lucky number is " . $luckynumber . "\n";
    
  2. or download this
    use warnings;
    use strict;
    ...
    
    # ------ load script with arg - expect ok
    ok( require 'luckynumber.pl --luckynumber=42', 'script loaded ok');
    
  3. or download this
    $ prove luckynumber.t
    luckynumber....ok 1/2Can't locate luckynumber.pl --luckynumber=42 in @
    +INC
    ..