in reply to archives etc
This relies on the standard Unixish behaviour of applications exiting with status zero if successful, non-zero otherwise. No doubt you could also do something similar with open()ing a pipe to gzip/bzip2/etc and if the open() fails, try the next one on your list.if(system('gzip', '-d', $file) == 0) { # it was a gzipped file } elsif(system('bzip2', '-d', $file) == 0) { # it was a bzipped file } ...
|
|---|