in reply to Re^4: divide multi-column input file into sub-files depending on specific column's value
in thread divide multi-column input file into sub-files depending on specific column's value

while (my $line = <$INPUT>) {
#chomp; # this gives me syntax errors???
...
}

The  chomp; statements in the code in this post operate on the default  $_ scalar, which does not seem to be initialized anywhere in the code. Let me suggest that what you are seeing is not a syntax error but a "Use of uninitialized value ..." warning (not an error) because you have very wisely enabled warnings in your code.

c:\@Work\Perl\monks>perl -wMstrict -le "chomp; " Use of uninitialized value $_ in scalar chomp at -e line 1.
A solution is to chomp something that has been assigned a value, like  $line in the while-loop conditional expression:
    chomp $line;


Give a man a fish:  <%-{-{-{-<

  • Comment on Re^5: divide multi-column input file into sub-files depending on specific column's value
  • Select or Download Code