TJCooper has asked for the wisdom of the Perl Monks concerning the following question:
I am attempting to process multiple .txt files using a Perl one-liner:
perl -lane 'next unless $. >45; @array = split /[:,\/]+/, $F[2]; print if $array[1]/$array[2] >0.5 && $array[3] >2' input.txt > output.txtThis runs fine on all files individually, however when using:
perl -i.MOD -lane 'next unless $. >45; @array = split /[:,\/]+/, $F[9]; print if $array[3]/$array[4] >0.5 && $array[4] >5;' *.txtIt returns an error of:
Illegal division by zero at -e line 1, <> line 35885.Why is that happening when each individual file runs to completion? Is there a better way to do this?
Back to
Seekers of Perl Wisdom