in reply to Find last line in Text file parsing
#!/usr/bin/perl -w use strict; my $file = "somefile"; open (FILE, '<', $file) or die "unable to open $file\n"; my $first_line = <FILE>; my $last_line; while(<FILE>){$last_line = $_;} print "$first_line"; #do what you need with them here print "$last_line";
|
|---|