Help for this page

Select Code to Download


  1. or download this
    my %options = (
        one => sub {
    ...
            print "Default\n";
        },
    );
    
  2. or download this
    if( exists $dispatch{ $action } ) {
         $dispatch{ $action }->();
    ...
    else {
        $default->();
    }
    
  3. or download this
    &{ $dispatch{ $action } || $default }();
    
  4. or download this
    while ( chomp( my $opt = <STDIN> ) ) {
        &{ $options{ $opt } || $options{ '' } }()
            or last;
    }