in reply to Writing to files
I've got a program online that does insertion into a file
(http://www.pobox.com/~japhy/tmp/perl/add_lines). But the
bigger question is, WHY DO YOU NEED TO DO THIS? Observe:
open FILE, ">>data" or die "can't append to data: $!"; print FILE "NEW RECORD\n"; close FILE; # now, to store the file's contents in an array, MOST # RECENT DATA FIRST, use unshift instead of push! open FILE, "data" or die "you know the drill... $!"; unshift @contents, $_ while <FILE>; close FILE;
|
---|
Replies are listed 'Best First'. | |
---|---|
RE: RE: Writing to files
by turnstep (Parson) on Apr 08, 2000 at 07:23 UTC | |
by btrott (Parson) on Apr 08, 2000 at 08:34 UTC | |
by japhy (Canon) on Apr 09, 2000 at 00:11 UTC |
In Section
Seekers of Perl Wisdom