M
mike
Hi,
I am using perl and need to add some text lines before the word
"package" in the file. I have read about Tie::File
and I am trying to use it as below. But I am unable to see how I can
match the word "package" and add
/* ---- Insert text here ---- */
on the line before "package".
Any ideas?
//mike
sub modify {
my @line_array;
my $line;
my ($file) = @_;
print "Modifying file, $file\n";
tie @line_array, 'Tie::File', $file or die "Can not tie file:$!";
for $line(@line_array) {
//
}
untie @line_array;
}
I am using perl and need to add some text lines before the word
"package" in the file. I have read about Tie::File
and I am trying to use it as below. But I am unable to see how I can
match the word "package" and add
/* ---- Insert text here ---- */
on the line before "package".
Any ideas?
//mike
sub modify {
my @line_array;
my $line;
my ($file) = @_;
print "Modifying file, $file\n";
tie @line_array, 'Tie::File', $file or die "Can not tie file:$!";
for $line(@line_array) {
//
}
untie @line_array;
}