for(glob("*.gz")){ my @o = `zcat $_ | sed 's/[<> ]//g'`;chomp @o;push @l,@o; } my %h = map { $_, 1 } @l;