in reply to Delete the first line of a file ?
Removing first and last line of a file:
use strict; open FILE, "</path/to/inputfile" or die "Blerch: $!\n"; # Set $/ to whatever your line terminating char is in inputfile my @lines=<FILE>; shift @lines; pop @lines; # @lines now contains the file contents without the first and last lin +es.
Removing leading # from a line:
$line=~s/^#//;
Inserting a leading # in a line:
Note that the above code is untested however, and might do all kinds of funny stuff, not excluding actually working as intended.$line=~s/^(.)/#$1/;
CU
Robartes-
|
|---|