Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

How could I strip the . off of the end of every line in a text file (if it exists)? I'm new to text manipulation in perl. Thanks. -as

Replies are listed 'Best First'.
Re: Stripping dots
by btrott (Parson) on Oct 22, 2000 at 11:28 UTC
    % perl -pi.bak -e 's/\.$//' file1 file2 ...
    Take a look at perlrun for the command line options (in place editing), and perlre for the regex issues.
Re: Stripping dots
by japhy (Canon) on Oct 22, 2000 at 16:19 UTC
    TMTOWTDI:
    % perl -pli.bak -e'BEGIN{$/=".\n"}' FILES


    $_="goto+F.print+chop;\n=yhpaj";F1:eval