http://qs321.pair.com?node_id=1161419


in reply to Re^4: Regular expressions across multiple lines
in thread Regular expressions across multiple lines

Perl (the compiler) has no problem reading Windows or Unix line endings in scripts on any platform.

Perl programs may have problems when reading a Windows-generated file under Unix or a Unix-generated file under Windows, because Perl applies the conventions of the platform on which it executes and does not know the file has been generated on another OS.

If you transfer a file by FTP in ASCII mode, FTP will do the conversion for you. If you use Bin mode or SFTP, the con version will not occur and you may end up with problems.

As for chomp, I use it when I have a decent control of where the file has been generated (especially it it is a file I previously generated). When the file is coming from some outside source, I usually use aa tr// or a regex s/// to remove safely line endings.