#!/usr/bin/perl
use strict;

my @queried = `ls *.rar`; #`find . -type f -iname \"*.rar\"`;
foreach my $item (sort @queried) {
    chomp $item;
    if (! system("aunpack \"$item\"")) {
	system("rm \"$item\"");
    }
}
