Here's some code I inherited. I am trying to use this code to accomplish the same task on a different file. I want to use GetOpts::STD in place of the hard coding. My question is how do I pass the "file info" into the GetOpts::STD from a cron job? Also, any assistance redoing this code will help. Thanks!

#!/user/perl5/bi/perl require "getopt.pl" Getopt(i"); $file = "usr/local/home/pfuser/CURRENT_54_USERS"; # I want to remove t +his hard coding and use # the Getopts::STD, but how do I p +ass info # from a cron job? @sids = (); @sindinfo = (); $numbers = 0; $DATE = 'date + %Y%m%d'; #Is this a Unix call? If so, how can I use P +erl for this? chomp $DATE; if (! open(USERFILE, $file)) { die "could not open $file.\n"; } while (<USERFILE>) { $curline = $_; chomp($curline); push(@sids, $curline); push(@sidinfo, " "); numbers++ } close USERFILE; Sfile - $opt_i; if (! open(INFILE, $file)) {die "could not open $file. \n"; } while(<INFILE>) { $curline = $_; chomp($curline); $startpos = 0; $length = index $curline, " "; $checksid = substr $curline, $startpos, $length; $startpos = $length + 1; $cheinfoadd = substr $curline, $startpos; $foundsid = 0; $index = 0; while ( $index < $numbers ) { if ( $sids[$index] eq $checksid ) { $sidinfo[$index] = $checkinfoadd; } $index++; } } close INFILE;
MORE CODE FOLLOWS…..

In reply to Using GetOpts::STD by kirkbrown

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.