Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Array value changing for some reason

by kschwab (Vicar)
on Dec 31, 2018 at 22:44 UTC ( #1227850=note: print w/replies, xml ) Need Help??


in reply to Array value changing for some reason

You don't have to return anything to change an array.
#!/usr/bin/perl sub plus { for (@_) {$_++} } my @foo=(1,2,3,4); plus(@foo); for(@foo) {print "$_\n"};
Prints out:
2
3
4
5

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2021-09-19 15:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?