- Details
- Written by: po3dno
- Category: Perl
- Hits: 979
sub calcuac {
my $result = "";
my $curuac = $_[0];
my %hash = (
DONT_EXPIRE_PASSWORD => 65536,
NORMAL_ACCOUNT => 512,
TEMP_DUPLICATE_ACCOUNT => 256,
ENCRYPTED_TEXT_PWD_ALLOWED => 128,
PASSWD_CANT_CHANGE => 64,
PASSWD_NOTREQD => 32,
LOCKOUT => 16,
ACCOUNTDISABLE => 2,
);
my $i = 0;
for my $key (sort {$hash{$b} <=> $hash{$a}} keys %hash ) {
if ($curuac >= $hash{$key}){
$result = $result . " \| " if ($i > 0);
$curuac = $curuac - $hash{$key};
$result = $result . $key;
$i++;
}
}
return $result;
}