| Public Scratchpad | Download, Select Code To D/L |
#!/usr/bin/perl -Tw ##################################### # Script by Joseph W. Guillaume # # Last updated June 2, 2005 # ##################################### use strict; use CGI qw(:standard); print "Content-Type: text/html\n\n"; print '<body bgcolor="cccccc">'; ##################################### my $employee=param('employee_name'); my $certification=param('certification'); my $month=param('month'); my @month=""; my $day=param('day'); my $year=param('year'); my $mo_yr=param('mo_yr'); my @data; my @data_names; my $data_names; my $data; my $lines; my $lines1; my $number; my $i; my @mon = qw (January Feburary March April May June July August Septem +ber October November December); ##################################### # Read Names.txt file # ##################################### open(JOE, "<Files/Names.txt") or die "No can! :$!"; @data_names = <JOE>; #foreach (@data_names) { #close (JOE); #} print "Names are @data_names<p\/>"; $lines1 =scalar@data_names; print "Number of records in Database is $lines1 <HR><p\/>"; ##################################### # Read File # ##################################### #print "Employee <b> $employee </b>"; for ($i=0; $i < $lines1; $i++) { print "Name $i is $data_names[$i]<p\/>"; open(FH, "<Files/$data_names[$i].txt")or die "No can! :$!"; print "Name $i is $data_names[$i]<p\/>"; @data = <FH>; print "Data for $data_names[$i] is $data[$i]<p\/>"; close (FH); } ##################################### # Checking File # ##################################### exit;
Sample Data (2 records 5 lines)
Cardio-Pulmanary Resucitation Course
8
1
2005
8 2005
Emergecy Vehile Operator Course
1
1
2004
1 2004
JWG