Brandon McCaig wrote:
Hello,
Just a couple of comments on some of your code. :)
my $start_line = 2;
unless($lines[1] =~ /^\s*$/)
{
warn "The second line isn't empty" ;
$start_line--;
}
@lines = @lines[$start_line..$#lines];
You are copying almost all of @lines to @lines when you should be using
perl's built-in functions to just remove elements from @lines without
the copying:
splice @lines, 0, $start_line;
map { s{(.*)}{$directory/$1}; $_; }
@dirfiles[1..$#dirfiles];
What is $_; returning a value to? You are using map in a void context.
That is better written as:
s{(.*)}{$directory/$1} for @dirfiles[ 1 .. $#dirfiles ];
Or as:
$_ = "$directory/$_" for @dirfiles[ 1 .. $#dirfiles ];
John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction. -- Albert Einstein
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/