http://www.perlmonks.org?node_id=722418


in reply to Traversing SubDir and Execute Unix Command

Is this limited to *NIX? FWIW, you can merge your system calls into one:

for my $sd (@dirs) { system(qq{cd "$sd" && gunzip *.gz}); }
Personally, I would add a check for system's return value and redirect gunzips output. For more robustness it might be better (slightly slower) to first scan for all *.gz files below @dirs and then decompress each file individually. That would allow to check the success of the decompression operation for each individual file - if that matters.