my $found; while (<$fh>) { if (/^222$/) { $found = 1; $last; } } print while <$fh>;