Thanks, that was the problem. I changed %cmd to look like this
my %cmd=( "-p" => { "COMMAND" => { "linux" => "/usr/local/bin/setp +ass.expect $USERNAME $NEWPASS", "aix" => "" }, "ACTION" => "Password Changed", "CHECKMODES" => \&checkparms($MODE), "ERRORS" => { "$OS:256" => "$USERNAME Does +not exist" } }, "-d" => { "COMMAND" => { "linux" => "/usr/sbin/userdel - +r $USERNAME", "aix" => "" }, "ACTION" => "Deleted", "CHECKMODES" => \&checkparms, "ERRORS" => { "$OS:1536" => "$USERNAME Does n +ot exist" } }, "-a" => { "COMMAND" => { "linux" => "/usr/sbin/useradd $ +USERNAME && /usr/local/bin/setp +ass.expect $USERNAME $NEWPASS", "aix" => "" }, "ACTION" => "Added", "CHECKMODES" => \&checkparms, "ERRORS" => { "$OS:2304" => "$USERNAME exists +" } }, "-ha" => { "COMMAND" => { "linux" => "/usr/bin/htpasswd - +bd $APACHECONF $USERNAME $NEWPASS", "aix" => "" }, "ACTION" => "Added", "CHECKMODES" => \&checkparms }, "-hd" => { "COMMAND" => { "linux" => "/usr/bin/htpasswd - +D $APACHECONF $USERNAME", "aix" => "" }, "ACTION" => "Deleted", "CHECKMODES" => \&checkparms } );


and the checkparms sub to look like this

############## sub checkparms ############## { push (@THINGS, "Username") if ( $USERNAME eq "UNDEFINED" ); push (@THINGS, "Password") if ( $NEWPASS eq "UNDEFINED" and $MODE eq "-a" or $MODE eq "-p" or $MODE eq "-ha"); push (@THINGS, "httpd.conf") if ( $MODE eq "-ha" or $MODE eq "-hd" and $APACHECONF eq "UNDEFINED" ); my $return_val = ( scalar(@THINGS) == 0 ) ? "0" : "1"; return $return_val; }


Ted
--
"That which we persist in doing becomes easier, not that the task itself has become easier, but that our ability to perform it has improved."
  --Ralph Waldo Emerson

In reply to Re^2: Unexpected results returned from a hash by tcf03
in thread Unexpected results returned from a hash by tcf03

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.