Help for this page

Select Code to Download


  1. or download this
    "o|c|out=s" => \my $csv;
    
  2. or download this
    GetOptions ("length=i" => \$length,    # numeric
                "file=s"   => \$data,      # string
                "verbose"  => \$verbose)   # flag
    
  3. or download this
    sub GetOptions {
        my %options = @_;
        # ...
    }
    
  4. or download this
    my $sref = \my $scalar;
    
  5. or download this
    my $scalar;
    my $sref = \$scalar;
    
  6. or download this
    my %hash = (
        some_key => \my $value,
        # ...
    );
    
  7. or download this
    my $value;
    my %hash;
    $hash{some_key} = \$value;
    
  8. or download this
    ($csv) and ($xls = $csv);
    
  9. or download this
    $xls = $csv if $csv;
    
  10. or download this
    sub foo {
        my $value = rand(5);
        return $value > 2 or die "Value was not greater than 2.\n";
    }
    
  11. or download this
    sub foo {
        my $value = rand(5);
        return($value > 2) or die;
    }
    
  12. or download this
    sub foo {
        my $value = rand(5);
        return $value > 2 || die;
    }
    
  13. or download this
    sub foo {
        my $value = rand(5);
        return ( ($value > 2) || die );
    }