in reply to Delete last record in text file
Pretty easy solution actually. Check out the following:
#!/usr/bin/perl -w use strict; my @lines=<DATA>; pop @lines; open(FOUT,"> myout.txt") or die $!; print FOUT @lines; close FOUT; __END__ line 1 line 2 line 3 line 4 line 5 line 6 line 7 line 8 line 9 line 10 line 11 line 12 line 13 line 14 line 15
Here is the output:
--$ cat myout.txt line 1 line 2 line 3 line 4 line 5 line 6 line 7 line 8 line 9 line 10 line 11 line 12 line 13 line 14
Peter @ Berghold . Net
Sieze the cow! Bite the day!
Nobody expects the Perl inquisition!
Test the code? We don't need to test no stinkin' code!
All code posted here is as is where is unless otherwise stated.
Brewer of Belgian style Ales
|
|---|