Re: Splitting and comparing file names



boyd wrote:
my $avg = sum(@times) / (scalar @times); # @times would work,
# but scalar guarantees the number of elements.

The division operator "guarantees" the number of elements just as much
as the scalar keyword does. I don't have an issue with your use of
scalar if it helps you read the code more clearly, but the comment is
misleading at best.

The scalar keyword is only relevant where the array would otherwise be
evaluated in list context. The division operator (as well as all the
other arithmetic operators) impose scalar context all on their own,
always, and un-ambiguously.

Paul Lalli

.