Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: passing a value to a function

by bikeNomad (Priest)
on Jun 25, 2001 at 21:07 UTC ( [id://91348]=note: print w/replies, xml ) Need Help??


in reply to passing a value to a function

This isn't C, and you don't need the parentheses after cleararray. In fact, they're hurting you, since by using them, you've told Perl that cleararray takes no arguments. Remove them.

Also, note that you're taking the first argument to cleararray and throwing it away, and then referring to a global. It might be better (depending on your program design) to pass in $radiovar. If you want to call cleararray as a class method, you can do this:

sub cleararray { my $class = shift; # ignored my $radiovar = shift; ... } # then call as: PATTERNS->cleararray($someRadioVar);

or if you are always calling it from within the same package it's defined in, perhaps:

sub cleararray { my $radiovar = shift; ... } # then call as: cleararray($someRadioVar);

Log In?
Username:
Password:

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

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

    No recent polls found