0

I am trying to unzip a file using a Perl script. In order to unzip the file I chose to try and invoke the UNIX command system unzip. My problem seems to be that the command is not reading the variables.

my $file_path = "/home/data"
my $file_name = "TEST.ZIP"

system ('unzip $file_path/$file_name');

When I run the command I see.

unzip: cannot find /, /.zip or /.ZIP.

How do I solve this problem?

2 Answers 2

4
system ("unzip $file_path/$file_name");

Use double quotes if you want to use string interpolation.

Sign up to request clarification or add additional context in comments.

Comments

4

Better use a relevant (Archive::Extract) module.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.