#!perl use strict; use warnings; use PerlIO::gzip; open FOO, "<:gzip", "file.gz" or die $!; while () { next unless /search term/; my @f = split '::'; push @productArray, $f[1]; }