#!/usr/bin/perl use strict; use PerlIO:gzip; for my $file (<*.tgz>) { open( T, "<:gzip", $file ) or do { warn "open failed on $file: $!\n"; next; }; while () { print if /target_regex/; } }