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

Re^2: Why use references?

by chas (Priest)
on Dec 12, 2005 at 01:55 UTC ( #515929=note: print w/replies, xml ) Need Help??


in reply to Re: Why use references?
in thread Why use references?

In your "Without References" example, don't you need  return ++$arg;?
(and a semicolon after shift?)
Also, consider the following:
sub increment { ++$_[0]; } $num=0; increment($num); print $num,"\n";
which shows that args are passed "by reference" by default. Of course, it may not be good style to alter @_ in this way, but the point is that you don't need to pass a reference to alter the argument inside the sub.
(Updated to make less confusing.)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://515929]
help
Chatterbox?
[Corion]: Mhhmmm - https://sod.pixlab .io/ looks really interesting for embedding with Perl (XS), but they don't have any kind of free model available and the cheapest pretrained model costs EUR 40 :-(
[Corion]: Maybe I should mail them to find out if they can provide me a "hotdog / no hotdog" model for developping the XS bindings. It would be nice to have a self-contained XS library for applying models to data. Or maybe I should look at TensorFlow, which can...
[Corion]: ... at least be trained by me, instead of relying on a vendor

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2018-06-18 10:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (109 votes). Check out past polls.

    Notices?