#!/usr/bin/perl use CGI; use File::Copy; use warnings; # define names of student reg info file,student count file and name of js file to be sritten out $sdata="/home/hampton1/data/student.dat"; $scnt="/home/hampton1/data//student_count.dat"; $jscd="/home/hampton1/data/jscd.js"; # open existing student reg file open(SDATA,"$sdata")|| die("Could not open file: $!\n"); # Put file into array @line = ; print @line; # confirms array contains contents of file close SDATA; # delete existing count & js file - so they can be to be recreated # test code unlink($scnt); unlink($jscd); # create file(> symbol is overwriting) open (SCNT,">$scnt"); close SCNT; # set all permissions chmod 0777, $scnt or die "Couldn't chmod $scnt: $!"; # create file(> symbol is overwriting) open (JSCD,">$jscd"); # print results to javascript file print JSCD "This is a test ()\n"; close JSCD; # set all permissions chmod 0777, $jscd or die "Couldn't chmod $jscd: $!";