in reply to untarring number of files

Any line similar to

system('tar -xvf $file');

should quote the filename:

system(qq(tar -xvf "$file"));

to protect against spaces. This is not perfect; it doesn't protect against doublequotes in the filename.