Help for this page

Select Code to Download


  1. or download this
    if (@ARGV == "clean"){ print "cleaning up dirs"; clean(); }
    
  2. or download this
    if($ARGV[0] eq "clean") { # eq, not ==, for strings
      print "cleaning up dirs";
      clean();
    }
    
  3. or download this
    sub clean_handler
    {
    ...
    }
    
    # ...
    
  4. or download this
    my %cmds = (
      'clean' => \&clean, # reference to the subroutine 'clean'
      'make'  => \&make,  # reference to 'make'
      # ...
    );
    
  5. or download this
    my $cmd = $cmds{$ARGV[0]}; # get the coderef
    &$cmd();                   # call it