Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Subroutine Behaviour

by TheEnigma (Pilgrim)
on Sep 25, 2004 at 03:14 UTC ( [id://393740]=note: print w/replies, xml ) Need Help??


in reply to Subroutine Behaviour

@_ is an array, and trying to see if it's equal to something tests the size of the array, not the contents. You should put something like

$num = shift;

at the beginning of the subroutine, and then say things like

if ($num == 0){

That way you're testing the actual contents of the array. (Also note that the $num inside the subroutine is not the same variable as the $num outside the subroutine; although in this case they will always have the same value.)

TheEnigma

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2024-04-19 09:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found