in reply to truncate only a last blank line
or#!/usr/bin/perl -w use strict; my ($myfile, @LINES); open $myfile, "file" or die "Unable to open file: $!\n"; push @LINES, $_ for (<$myfile>); #print "$_" for @LINES; chomp ($LINES[$#LINES-1]) if ( $LINES[$#LINES] =~ m/\s+/ ); #print "$_" for @LINES;
#!/usr/bin/perl my @file = qx/cat file/; chomp ($file[$#file]) if $file[$#file] =~ m/\s+/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: truncate only a last blank line
by tcf03 (Deacon) on Dec 30, 2005 at 03:18 UTC |