[PBML] Re: write to file
- Do you get the 'die' message?
You could change the 'die' call to:
die "Cannot open hello.txt. $?: $!";
This will print an error code and error message which may be helpful.
Someone else wrote about what directories have to exist (and their
permissions) in order for you to open a file there.
You may want to create these directories in your script if they don't
already exist. I suggest the File::Path module and the mkpath()
--- In perl-beginner@y..., Chanda Adams <adams@g...> wrote:
> I was attempting to start off with this and work my way from there:
> open (FILEHANDLE, ">hello.txt") or die "Cannot open hello.txt";
> print FILEHANDLE "Hello!";
> close (FILEHANDLE);
> but the entire script hangs up and doesn't process.
> Chanda Adams
> Phone (620) 276-0841
> Fax (620) 275-2889
> Not one shred of evidence supports the notion that life is serious.
> > From: dougawells@y...
> > Reply-To: perl-beginner@y...
> > Date: Tue, 27 Feb 2001 20:54:47 -0000
> > To: perl-beginner@y...
> > Subject: [PBML] Re: write to file
> > Chanda--
> > What syntax are you using when you try to open the filehandle?
> > --- In perl-beginner@y..., Chanda Adams <adams@g...> wrote:
> >> I am working on a site where there are a ton of order forms, and
> > what I'd
> >> like to do is this:
> >> 1. every time an order is submitted I want that order saved in a
> > specific
> >> place depending on certain variables in the form. Say, they are
> > Region
> >> 1, Store 4 (there are 12 regions and 500 stores). I want the
> > saved in
> >> region1/4/ordernumber.txt (order number is also a variable in
> > form)
> >> How on earth would I go about doing this?
> >> I've attempted open FILEHANDLE, but I must have done something
> > wrong because
> >> it wouldn't write to a file. To write the file, do the
> > have to
> >> be specific for that folder?
> >> Thank you for your help!!!
> >> Chanda
> >> --
> >> Chanda Adams
> >> Phone (620) 276-0841
> >> Fax (620) 275-2889
> >> adams@g...
> >> Not one shred of evidence supports the notion that life is
> > Your use of Yahoo! Groups is subject to