Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Simple array question

by Roger (Parson)
on Dec 23, 2003 at 01:01 UTC ( [id://316543]=note: print w/replies, xml ) Need Help??


in reply to Simple array question

I just want to add why you are printing the value of '1', other monks have already pointed out a fix to your problem.

Your code, print length(@attrvals); is equivalent to print length( scalar @attrvals );, which is equivalent to print length("2"), which prints "1", the length of string "2".

Run the demo code below -
my @array = 0..99; # 100 element array print length(@array);
The output is 3, since the string "100" (elements) has 3 characters.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-25 15:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found