Try using the Shell package.
use Shell;
I was required to do NIS password authentication in my webpage, and here is the script that I used to figure it out.
#!/bin/perl -w use strict; use diagnostics; use Shell; print "Enter your username: "; my $USER = <STDIN>; chop ($USER); print "Password: "; my $PASS = <STDIN>; chop($PASS); # ypmatch is a linux shell command. my $str = ypmatch("$USER", "passwd"); chop($str); my @Tmp = split(":", $str); my $Tr = $Tmp[1]; my $salt = substr($Tr, 0, 2); my $ENCPASS = crypt($PASS,$salt); print "-------------------------------------------------\n"; print "String from yp: $str\n"; print "Transformed to: $Tr\n"; print "Salt for pass: $salt\n"; print "Your encrypted Password: $ENCPASS\n"; print "Password from ypcat: $Tr\n";

Now mind you, this was only a test. I certainly don't do any code that willy-nilly displays a person's password to the word.

Kristofer Hoch.

In reply to Re: running unix commands under perl by krisahoch
in thread running unix commands under perl by Anonymous Monk

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.