CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
File Access



Feb 15, 2001, 5:09 AM

Post #1 of 2 (288 views)
File Access Can't Post

I'm very new to perl (I have a bit of experience in other languages though, not much) so this may be simple...

For some reason my perl files can't seem to access external files when I run them. This goes for scripts that I have downloaded and coded myself. Perl runs the scripts fine, but no matter what it will not open the datafiles and just dies when it tries to.

I've tried everywhere I can think of for help on this one, if anyone can work out what's wrong I would be very grateful!


Feb 15, 2001, 12:24 PM

Post #2 of 2 (280 views)
Re: File Access [In reply to] Can't Post

1 - Make sure your paths are right.
2 - Make sure the files are coded right.
3 - Make your code have good error messages. (See below)
4 - Add in extra debugging features. (See below)

Here's a sample script that would be very easy to debug..

#!/usr/bin/perl -w 
use CGI::Carp qw(fatalsToBrowser);

open (INF, "noexsistfile.txt") || die "noexsistfile.txt: $!";
print $_ while (<INF>);
close (INF);

Jeffrey "muinatit" Lamoureux


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives