Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Unexpected Output

by nvivek (Vicar)
on Jul 28, 2010 at 11:41 UTC ( #851703=note: print w/ replies, xml ) Need Help??


in reply to Unexpected Output

For checking the length of an array,don't use $#arrayname because it won't give the number of elements in an array and it gives the highest index of the array which is number of elements - 1 in the array.If you want to check the length of an array, you assign an array to scalar, then it will give the actual number of elements in the array.There is one more problem in $#arrayname, it gives the value by adding the value of $[ with highest index of an array.In your script, if you change the value of $[ variable, then $#arrayname won't give the correct value.


Comment on Re: Unexpected Output

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (17)
As of 2014-08-28 15:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (263 votes), past polls