windowsperlcompressionwinrar

How can I call winrar in perl on windows?


Is it possible to call winrar through perl on a windows system, such as

perl -e "rar a -rr10 -s c:\backups\backup.rar @backup.lst"

If so, is there a more efficient way to do this?

I've looked up "perl -e" +winrar on google, however none of the results gave me any answer that was remotely close to what I was looking for. The system I'm running this on is a Windows XP system. I'm open to doing this in another language like python if its easier; however I am more comfortable with Perl.


Solution

  • One way to execute external commands from a Perl script is to use system:

    my $cmd = 'rar a -rr10 -s c:\backups\backup.rar @backup.lst';
    if (system $cmd) {
        print "Error: $? for command $cmd"
    }