Help for this page

Select Code to Download


  1. or download this
    
    use strict;
    ...
        my $sref = shift;
        say $$sref;
    }
    
  2. or download this
    my $str = 'hello';  
    do_stuff($str);   #legal: no slash in position 1 of arg list
    
    --output:--
    hello
    
  3. or download this
    my $str = 'hello';
    do_stuff(\$str);   #illegal: slash in position 1 of arg list
    
    --output:--
    Type of arg 1 to main::do_stuff must be scalar (not single ref constru
    +ctor)
    
  4. or download this
    my $str = \'hello';
    do_stuff($str);  #legal: no slash in position 1 of arg list
    
    --output:--
    SCALAR(0x100839858)