while (<>) { chomp; next unless length; if ($_ < 0) { push @negatives, $_; } else { push @positives, $_; } }
Update: This code was posted before the OP added code to his post.
Dave
In reply to Re: calculate sum of numbers inside a text file
by davido
in thread calculate sum of numbers inside a text file
by CR18
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |