jvallee has asked for the wisdom of the Perl Monks concerning the following question:
I deleted all the processing code to see if it would simply create and save after I uploaded it.#!/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 = <SDATA>; 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: $!";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: saving a file
by chromatic (Archbishop) on Oct 23, 2007 at 21:11 UTC | |
|
Re: saving a file
by toolic (Bishop) on Oct 23, 2007 at 21:20 UTC | |
|
Re: saving a file
by thezip (Vicar) on Oct 23, 2007 at 21:46 UTC | |
by erroneousBollock (Curate) on Oct 24, 2007 at 01:46 UTC |