解决方法
假设要打印的行号已排序.
open my $fh,'<','line_numbers' or die $!; my @ln = <$fh>; open my $tx,'text_file' or die $!; foreach my $ln (@ln) { my $line; do { $line = <$tx>; } until $. == $ln and defined $line; print $line if defined $line; }