Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: Returning a tied scalar

by MarkusLaker (Beadle)
on Apr 17, 2005 at 11:00 UTC ( #448619=note: print w/replies, xml ) Need Help??


in reply to Re^2: Returning a tied scalar
in thread Returning a tied scalar

Nobull writes:
There is no need for a prototype which also means you don't need to forgo the OO if you don't want to.

sub int_monitor:lvalue { my $var=\shift; print "$var\n"; $$var };

Very neat! I guess that relies on two facts: that @_ contains aliases to the args (which I knew but had forgotten) and that shift returns the first element of the array, rather than a copy of it.

Thanks for your suggestions,

Markus

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (1)
As of 2023-03-25 23:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (63 votes). Check out past polls.

    Notices?