Okay - here's the situation. I'm a TOTAL perl Newbie. In fact, I'm what my old Gunny used to call a NUB - that's a Non Useful Body to you civilian types.

I run http://www.lrsehosting.com, a small slash and scoop hosting business. I'd like to play a more active role in the business (other than just book keeping and sales, basically) and help the admins out (and myself) and be more productive, so I have to learn perl. What a better way to do that then to write something I need written?

I know what I want to do - I need a script that will add users to Password.pm for me, and I'd like to try and write that script. With the help of a friend, I've managed to figure out how to make the script always fine the correct file, and set it as $filepath. At that point, I'm completely lost. The way the module currently works, you setup one or more virtual users at install, and you then have to find and hand edit the file thereafter. That sucks. Hard. So, the following is what I have to date, and from here I'd like some idea(s) on how to make it (a) check to see if the user you want to add already exists, (b) add that user if not and (c) remove a user with a command like argument (like -delete foo):

#!/bin/perl # # addvirtu.pl by William Scott Lockwood III and Peter Johnson # use DBIx::Password; my $filepath = $INC{"DBIx/Password.pm"};

In reply to How do I write what I need, given that I know nothing at all about perl. by Vladinator

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.