Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

sub argument passing? (TIMTOWTDI)

by temporal (Pilgrim)
on Sep 13, 2012 at 18:36 UTC ( #993555=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    # single arg, used for simple and dirty
    sub foo {
    ...
        # will warn me if $href->{hello_sub} is not defined
        print 'hi!' if $href->{hello_sub};
    }
    
  2. or download this
    # processes arguments passed to subroutine in hashref
    # returns hash
    ...
        print 'hi!' if $opts{hello_sub};
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://993555]
Front-paged by lidden
help
Chatterbox?
[atcroft]: PriNet: %hash = ();? or foreach my $k ( keys %hash ) { delete $hash{$k}; }?

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2017-06-28 02:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (619 votes). Check out past polls.