Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Use reference for functions in functions

by 7stud (Deacon)
on Feb 26, 2013 at 01:03 UTC ( #1020592=note: print w/ replies, xml ) Need Help??

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)
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1020592]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2014-09-15 03:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (145 votes), past polls