in reply to Substr warning

There's not a lot to go on here, but my gut feeling is that $ch_count must be getting larger than the string you're looking at.

It looks to me like you're trying to grab the first two words out of each line... maybe a different approach would work better?

my $line = 'This is a test'; my (@words) = split( /\s+/, $line); my $twowords = $words[0] . ' ' . $words[1]; print "$twowords\n";
Trek