in reply to Re^2: How to have perl check line length
in thread How to have perl check line length

Replace $line with whatever variable you are storing the line in. (In this case, $_)

Also, you should probably print the modified lines to the output file at some point inside the loop.

PS: use warnings; use strict;, and opens in the form of open my $filehandle, '<', $filename or die "I couldn't open the file.  OS says: $!"; will help highlight likely mistakes in your code and illuminate the reasons for any file errors.