Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Strange behavior of array in scalar context

by hippo (Archbishop)
on Jan 26, 2026 at 10:32 UTC ( [id://11167235]=note: print w/replies, xml ) Need Help??


in reply to Re: Strange behavior of array in scalar context
in thread Strange behavior of array in scalar context

That indicates that the array does have one element.

my @x = (); my @y = (99); print "x count is $#x, y count is $#y\n";

results in

x count is -1, y count is 0

🦛

Replies are listed 'Best First'.
Re^3: Strange behavior of array in scalar context
by ikegami (Patriarch) on Jan 26, 2026 at 15:39 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2026-04-10 12:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.