Help for this page

Select Code to Download


  1. or download this
    my %defaults = ref( $_[2+$[] ) ? %{$_[2+$[]} : {};
    
  2. or download this
    sub routine 
    {
    ...
        my $var      = $_[1+$[];   # scalar
        my %defaults = ref( $_[2+$[] ) ? %{$_[2+$[]} : {}; # optional hash
    + ref.
    #blah...
    
  3. or download this
    prompt> perl -we "print ref( undef() ) ? 'y' : 'n'"
    n