greymoose has asked for the wisdom of the Perl Monks concerning the following question:
I'd appreciate any thoughts on why the same script is getting different results in relation to exactly the same file.#!/usr/bin/perl -w use lib "/usr/local/lib/perl/lib/perl5/site_perl/5.8.8"; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use strict; print header; my ($x, $y); my $datafile = "/full/path/to/file/data.txt"; system("perl /full/path/to/file.cgi")==0 or die "system failed $?" +; if(!(-w $datafile)){ print "What file?<br>"; } else{ open (FILE, '<', '$datafile') || die "Could not read $datafile $!\ +n"; $x = <FILE>; $y = <FILE>; close (FILE); } print $x."<br>"; print $y."<br>";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File exists when confirmed in script but not when open is attempted by same script
by ikegami (Patriarch) on Jun 12, 2009 at 02:23 UTC | |
by greymoose (Beadle) on Jun 12, 2009 at 03:29 UTC |