Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 scrutinizing the Monastery: (16)
As of 2015-07-01 20:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (19 votes), past polls