Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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?
[chacham]: holy old sharks, batman!

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2017-12-17 16:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (465 votes). Check out past polls.

    Notices?