hello wise monks.. my problem today is a simple one at that but I am unfortunately just beginning to learn the way of perl. My problem is that I have been asked to write a script that checks for command line switches such as "script1.pl -l logfile.txt -u useraccounts.txt -r report.txt" I don't care what order they are in but as long as it checks logfile and useraccounts exist and reports an error to the screen like "usage: wrong switch used! -c doesnt exist" and stuff like "logfile not found". How would I accomplish this? oh wise perl monks please hear my call! also.. I dont want to use geoopt::long module! just using good ol strict and warnings!! ya no this isn't a home work assignment. This is a task from work which has been given to me but unfortunately they will not install any modules, none what soever and will not give me access to anything except to write this script.. ultimatly what it does is parses a logfile and useraccounts file and searches for certain strings such as times and usernames. I have never done perl before but yet I am being told to do this! anything would be of help! anything..

In reply to command line switches (array) by blackice69

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.