@hostnames = qw(baloo beast belle chip cogsworth lefou potts); my $timestamp=$ARGV[0]; for my $hostname (@hostnames){ my $logpath = "/archive/$hostname/www/logs/access_log.$timestamp"; #print "$logpath\n"; ## change this open (LOGS,"/path/to/gzip -d -c $logpath.gz |") or die "cant open $logpath\n"; while (){ regex{ get valuable data here; } } }