You can use chop to remove a character from the end of a string, it works on $_ by default. I assume that you don't want to get rid of the line terminator so I remove it first using chomp then it gets replaced by say when the line is printed.
johngg@abouriou:~/perl/Monks$ perl -Mstrict -Mwarnings -E ' open my $inFH, q{<}, \ <<__EOD__ or die $!; this line does not match this SUM is wrong __EOD__ say q{}; while ( <$inFH> ) { chomp; do { say; next; } unless m{SUM}; chop; chop; say; } close $inFH or die $!;' this line does not match this SUM is wro
I hope this is helpful.
Cheers,
JohnGG
In reply to Re: Trim Two Characters On Line
by johngg
in thread Trim Two Characters On Line
by jalopez453
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |