Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: why scalar(@array) is not numeric?

by aufflick (Deacon)
on Jul 17, 2009 at 00:37 UTC ( [id://780895]=note: print w/replies, xml ) Need Help??


in reply to why scalar(@array) is not numeric?

As id:Fletch says, using comma to provide a list to print elegantly solves the problem.

To make it clearer that it is purely a precedence issue though, you can fix your existing statement by making precedence explicit with brackets:

print "number of files: " . ($size-2) . "\n";

Replies are listed 'Best First'.
Re^2: why scalar(@array) is not numeric?
by MidLifeXis (Monsignor) on Jul 17, 2009 at 16:02 UTC

    Also check out perlop for the precedence table. . and - bind at the same level. , is lower on the table, so the minus would get executed first.

    --MidLifeXis

    The tomes, scrolls etc are dusty because they reside in a dusty old house, not because they're unused. --hangon in this post

Log In?
Username:
Password:

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

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

    No recent polls found