in reply to avoid warnings in Copying and Substituting Simultaneously

$totcalls += $layer3 =~ /^([0-9]*)/ && $1;

or better yet

$totcalls += do { no warnings 'numeric'; 0+$layer3 };

Your s/// will never match because it's modifying $totcalls after the sum-assign (i.e when it contains a number).