Help for this page

Select Code to Download


  1. or download this
        GetOptions(
            'f'     => \my $filename,
    ...
            maybe baz      => $batman,
            maybe universe => $universe,
        )
    
  2. or download this
    sub foo( %options ) {
        if( ! exists $options{ baz } ) {
    ...
        };
        ...
    }
    
  3. or download this
    sub foo( :$baz = 'Superman', :$bar, :$file, :$universe='DC' ) {
    }
    
  4. or download this
    sub foo( %options ) {
        ...
    }
    
  5. or download this
    sub option ( $key, $def, $options ) {
        if( !exists $options->{ $key } ) {
    ...
        }
        return $options
    }
    
  6. or download this
    sub foo( %options ) {
        option baz      => 'Superman',
    ...
    
        return \%options
    }
    
  7. or download this
        option files => [glob('~/*')],
        option html  => $user_agent->get('https://example.com'),
    
  8. or download this
    use 5.020;
    use feature 'signatures';
    ...
    #is $f->foo( baz => undef ), { baz => undef, universe => 'meth_DC' }, 
    +'Positional parameters work';
    
    done_testing;