@tarfiles=`ls dirname`; foreach $tarfile(@tarfiles){ `tar -xf $tarfile -C ~/path_to_dir`; }