$/ = ""; open my $fh, "-|", "/usr/bin/bzcat $file"; while (<$fh>) { if (/uid=$mbnum/m) { print $_; last; } }