On Thu, 1 Jan 2004, Norman Zhang wrote:
> May I ask how could I list a file contents backward in a new file?
>
You might want to look at
File::ReadBackwards
When I first *discovered* comp.lang.perl.misc the very
first posting I saw was an announcement from Uri Guttman advising a new
edition of the read backwards module. I thought I'd fallen among madmen or
jokers :-)
I haven't used it but from the documentation;
use File::ReadBackwards ;
# Object interface
$bw = File::ReadBackwards->new( 'log_file' ) or
die "can't read 'log_file' $!" ;
while( defined( $log_line = $bw->readline ) ) {
print $log_line ;
}
which should be fairly easy to modify to write to a file.
--
Owen
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>