Ray, a couple of points, they're below... I've assumed that phrase.txt only contains one line, tell me if I've got the wrong end ofthe stick...
#!D:\perl\bin -w use strict; use Win32::AdminMisc; #use Win32::AdminMisc qw(SetPassword); chomp(my $Server = <STDIN>); 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 = <IN>; #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
Hope I've picked up the showstoppers, give that a go. It looks a bit hurried because I need to go and cook dinner!

andy.


In reply to Re: can i get the value outputed from my subroutine into my program as a value by andye
in thread can i get the value outputed from my subroutine into my program as a value by RayRay459

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.