in reply to Re: avoid warnings in Copying and Substituting Simultaneously
in thread avoid warnings in Copying and Substituting Simultaneously

$totcalls += [ $layer3 =~ m/^\s*([0-9]+) Active/ ]->[0];
needlessly creates an array and a reference. Use
$totcalls += ( $layer3 =~ m/^\s*([0-9]+) Active/ )[0];

Replies are listed 'Best First'.
Re^3: avoid warnings in Copying and Substituting Simultaneously
by JavaFan (Canon) on Oct 22, 2008 at 20:11 UTC
    And that needlessly performs a regexp. And since perl still has to do the ascii to numeric conversion, you might as well do it right away.
    { no warnings 'numeric'; $totcalls += $layer3; }
    And that will even work if $layer3 starts with a negative number or a float. It's a design feature that Perl works this way.