Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Tutorial on arguments for the new

by Joost (Canon)
on Dec 11, 2006 at 21:11 UTC ( [id://589152]=note: print w/replies, xml ) Need Help??


in reply to Tutorial on arguments for the new

Oh look, this isn't an argument. update2: video

sorry, couldn't resist ;-)

update:

foo($bar, $baz); # ... sub foo{ print "$_"; #will first print out the contents of $bar, then $baz ...
No it won't.

you mean

sub foo { print for @_; } # or sub foo { print @_; }

Replies are listed 'Best First'.
Re^2: Tutorial on arguments for the new
by Andrew_Levenson (Hermit) on Dec 11, 2006 at 21:17 UTC
    I was going to start with "I'd like to register a complaint!" but I realized it was the wrong sketch. We'll save that one for the tutorial on getting started with... that other language.

    And, thanks for pointing that out to me.
    C(qw/74 97 104 112/);sub C{while(@_){$c**=$C;print (map{chr($C!=$c?shift:pop)}$_),$C+=@_%2!=1?1:0}}
Re^2: Tutorial on arguments for the new
by PockMonk (Beadle) on Dec 11, 2006 at 21:21 UTC
    I think he was just trying to explain for others starting out what arguments were and how they were passed to subroutines, I don't think the exact code matters all that much. Even clearer might be:
    my ($bar, $baz) = ("Hello ", "World"); foo($bar, $baz); # ... sub foo{ print "$_[0]"; #prints "Hello " print "$_[1]"; #prints "World"

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-20 01:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found