Having
my in the same context as a trailing
if is usually bad form. As far as I can tell, the variables are declared regardless of the outcome of the
if and are scoped to the block.
In plain english, this means that the split is not occuring, but the variables are there, and you are still printing because there is no conditional on the print.
That's why I suggested using a
next call to skip to the next line. If it is a comment, there's no point in calling either
split or
print, is there?
Update:
For additional clarity, here's an example of what's happening:
while (<INFILE>)
{
my ($infile, $dir, $type);
if (!/^#/)
{
($infile, $dir, $type) = split;
}
print "$infile $dir $type\n";
}