使用Perl将解压缩输出重定向到特定目录

shu*_*ter -2 perl unzip

我想将压缩文件解压缩files.zip到一个与我的工作目录不同的目录.说,我的工作目录是/home/user/address,我想解压缩文件/home/user/name.

我试着这样做

#!/usr/bin/perl
use strict;
use warnings;

my $files= "/home/user/name/files.zip"; #location of zip file
my $wd = "/home/user/address" #working directory
my $newdir= "/home/user/name"; #directory where files need to be extracted
my $dir = `cd $newdir`;
my @result = `unzip $files`; 
Run Code Online (Sandbox Code Playgroud)

但是当从我的工作目录运行上面的内容时,所有文件都会在工作目录中解压缩.如何将未压缩的文件重定向到$newdir