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