Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Static Variables in Perl

by Tanktalus (Canon)
on Mar 30, 2006 at 20:32 UTC ( [id://540270]=note: print w/replies, xml ) Need Help??


in reply to Re: Static Variables in Perl
in thread Static Variables in Perl

Minor tweak:

$knob = $_[0] if @_;
That way, Parent->knob() is an accessor, while Parent->knob(undef) is a mutator that sets the $knob to undef. Slightly better:
if (@_) { # check that $_[0] is allowed. $knob = $_[0]; }
but that's only if there are invalid values you want to block.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-24 23:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found