I basically can get all of this to work as seperate scripts, however i thought i would try to get the second script in and call on it as a subroutine. I am trying to get the output of the subroutine and assign it a value that i can use in the script. What am i doing wrong? I get this error when i try to run this: Can't modify constant item in scalar assignment at C:\scripts\perl\ChPass.pl line 13, near "$Password;" BEGIN not safe after errors--compilation aborted at C:\scripts\perl\ChPass.pl line 19. Here's my code. Any help would be appreciated. Ray
# Ray Espinoza # ChPass.pl # This script calls in the encrypted password file and decrypts it and + uses # its value as $Password to change the account password to $Password. ###################################################################### +########################### #!D:\perl\bin -w use strict; use Win32::AdminMisc; #use Win32::AdminMisc qw(SetPassword); chomp(my $Server = <STDIN>); my $User = "Administrator"; &getPassword = my $Password; my $Result = Win32::AdminMisc::SetPassword( $Server, $User, $Password) + || die "Couldn't change password on $Server: $^E"; print $Result; sub getPassword { use strict; use Crypt::Blowfish_PP; my $key="abcdefghijklmnopqrstuvwxyz123456789"; my $bf = Crypt::Blowfish_PP->new($key); open (IN,"phrase.txt") || die "Can't read phrase.txt: $!"; while (<IN>) { my $encrypted_password = $_; my $decrypted_password = $bf->decrypt($encrypted_password); print $decrypted_data; }

In reply to 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.