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!
MORE CODE FOLLOWS…..#!/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;
In reply to Using GetOpts::STD by kirkbrown
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |