my $prog; for (qw/bzip2 gzip compress/) { chomp($prog = qx|which $_|); last if $prog; } print "Found: $prog\n";