Hello toolic,
The only thing you do with the variable is pass it as an input to your countThem sub.
Yes, but the variable $tmpfilecount is a package global (no my in sight, as you note), and within sub countThem the variable $_[0] is an alias to the variable passed as the first argument. Therefore the line:
$_[0]=$filecount;
within the sub actually should change $tmpfilecount to the value of $filecount. Proof of concept:
0:42 >perl -wE "sub f { ++$_[0] } $x = 42; f($x); say $x;" 43 0:43 >
So the problem is that $filecount is never incremented.
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re^2: Help needed with Perl script designed to find files by extension and count the number of chars
by Athanasius
in thread Help needed with Perl script designed to find files by extension and count the number of chars
by Griegomas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |