#!/usr/bin/perl -w $_=shift or die "Need file name\n"; my $command="cat $_ | "; # Deal with common shortcuts: s/\.tgz/.tar.gz/g; s/\.tbz/.tar.bz/g; STRIP: { $command .= "gzip -dc |", redo STRIP if s/\.gz$//; $command .="bzip2 -dc |", redo STRIP if s/\.bz2*$//; $command .="uncompress |", redo STRIP if s/\.Z$//; $command .="unarj |", redo STRIP if s/\.arj$//; $command .= "tar tvf - |" if s/\.tar$//; $command .= "ghostview - |" if s/\.ps//; } chop $command; # remove the last pipe system($command)