Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Thanks in advance - I'm no computer scientist, perl is my first programming language and up to a year ago I only wrote shell scripts.. seanmy ($cur_day, $cur_mon, $cur_yr) = (localtime())[3,4,5]; $cur_mon++; $cur_yr+=1900; my $cur_date=sprintf("%04d%02d%02d", $cur_yr, $cur_mon, $cur_day); my $limit = 2; do { foreach my $event_id (sort { $Sorts{$sortBy}->() } keys (%database) +) { my ($event_date_1, $event_title_1, $venue, $series, $style) = split(/\0/, $database{$event_id}); if ($event_date_1 >= $cur_date) { &getRandFeature; &Generate_Parsed_File(); } } } until ( $limit ); # code in debug mode "test2.pl" 180 lines, 4953 characters print "rand_int =" . "$rand_int\n"; print "rand_int2 =" . "$rand_int2\n"; my @index_db = %fdatabase; my @index_db2 = %database; # if ($index_db2[$rand_int2] > $limit) { # return(2); # } # else { print "array element:" . "$index_db2[$rand_int2]\n"; print "array element:" . "$index_db[$rand_int]\n"; # } } sub Generate_Parsed_File { # my $tmplFName = shift; # my $outFName = shift; my $Parameters = shift; open (OUT_FILE, "< $tmplFName") or die ("WARNING: Could not locate '$tmplFName': $!\n"); $_ = join('', <OUT_FILE>); s/<!-- ::(.+?):: -->/${$Parameters}{$1}/gs; s/::(.+?)::/${$Parameters}{$1}/gs; open (NEW_FILE, "> $outFName") or die ("WARNING: Could not locate '$outFName': $!\n"); print NEW_FILE $_; close (OUT_FILE); close (NEW_FILE); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: berkely database fun
by Russ (Deacon) on May 20, 2000 at 01:13 UTC | |
by Anonymous Monk on May 21, 2000 at 22:04 UTC | |
by Russ (Deacon) on May 22, 2000 at 05:07 UTC |