while () { my ($infile, $dir, $type); if (!/^#/) { ($infile, $dir, $type) = split; } print "$infile $dir $type\n"; }