use strict; use warnings; package NewChomp; use Data::Dump qw/pp dd/; use subs qw/chomp/; sub chomp { $_[0] =~ s/\n$//; # adjust here } pp my $line ="abcd\n"; chomp $line; pp $line;
Just export it from a new module into your scripts, and adjust the regex to your needs.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re^2: Dealing with files with differing line endings (overriding chomp)
by LanX
in thread Dealing with files with differing line endings
by dd-b
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |