Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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 meditating upon the Monastery: (10)
As of 2016-06-30 14:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (396 votes). Check out past polls.