in reply to tar a files from loop

If you check the return status of backticks (qx) with $? you may get more information about your problem (Basic debugging checklist tip #7):
print $? if $?;

Another quick thing to try is to replace the tilde with a full path:

`tar -xf $tarfile -C /home/foo/path_to_dir`;

See also: What's wrong with using backticks in a void context?