#!/usr/bin/perl # in-place dos-to-unix conversion (remove ^M's): my @file_list = <>; # update: adding these two lines to chomp @file_list; # read a list of file names for my $file ( @file_list ) { # not "@ARGV" open( I, $file ) or die "$file: $!"; open( O, ">$file.unx" ) or die "$file.unx: $!"; while () { s/\cM*//g; print O; } close I; close O; rename "$file.unx", $file or die "renaming $file.unx to $file: $!"; }