use Text::FixEOL; # Convert EOLs in the $file string to unix conventions my $fixer = Text::FixEOL->new; $file = $fixer->to_unix($file);