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

Re: How come @_ gets changed here?

by tobyink (Abbot)
on Jun 10, 2017 at 10:36 UTC ( #1192470=note: print w/replies, xml ) Need Help??


in reply to How come @_ gets changed here?

No, @_ is an alias to the sub's arguments. That's how things like chomp work:

sub my_chomp { $_[0] =~ s/\r?\n\z//sm; } my $var = "foo\n"; my_chomp $var; print "[[$foo]]\n";

perlsub says:

The array @_ is a local array, but its elements are aliases for the actual scalar parameters.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1192470]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2018-04-26 18:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?