用字典破解RAR密码代码,希望大家指正

初学Perl,自己写了一段用字典破解RAR密码的代码,希望大家给我指导一下。


#!/usr/bin/perl

use strict;
use warnings;

if (!$ARGV[0]) {
        print "Error! No command files name!\n";
        exit(1);
}

open(TABLEFILE,$ARGV[0]) || die "Can't open $ARGV[0]: $!";

while(<TABLEFILE>) {

        my $command='rar t -p';
        my $target='komodo.rar';
        my $password=$_;

        chomp($password);

        my $temp;

        $temp=system "$command$password $target >nul 2>nul";

        if ($.%1000==0) {
                print "$.\n";
        }

        if ($temp==0) {
                print "OK, I find Password. Password is $password\n";
                exit(0);
        }

print "Sorry, I can't find Password.\n";
exit(1);