Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
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? In reply to Process multiple input files using a one-liner by TJCooper
|
|