Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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

by aufflick (Deacon)
on Jul 17, 2009 at 00:37 UTC ( #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.


    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?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2023-10-04 19:53 GMT
Find Nodes?
    Voting Booth?

    No recent polls found