#!D:\perl\bin -w use strict; use Win32::AdminMisc; #use Win32::AdminMisc qw(SetPassword); chomp(my $Server = ); my $User = "Administrator"; my $Password = &getPassword; # ***********I've changed this line round - it doesn't # make sense the other way my $Result = Win32::AdminMisc::SetPassword( $Server, $User, $Password) || die "Couldn't change password on $Server: $^E"; print $Result; sub getPassword { # use strict; #*************you don't need this line - you only have to 'use strict' once per script use Crypt::Blowfish_PP; my $key="abcdefghijklmnopqrstuvwxyz123456789"; my $bf = Crypt::Blowfish_PP->new($key); open (IN,"phrase.txt") || die "Can't read phrase.txt: $!"; #*******this doesn't need to be a while loop if you're only expecting # one line my $encrypted_password = ; #you probably want to close your file, as well close IN; my $decrypted_password = $bf->decrypt($encrypted_password); return $decrypted_password; # ************** you probably want to return this value, # i.e. make it the result of this subroutine, unless # I've completely misunderstood. Also, your there was a # typo in your variable name } #******** you no longer need a closing-curly to close the while loop, but you do need one to close getPassword