Hi Dan,

> For what it's worth, "Mixing reads and writes" in perlopentut says
> that you probably want:
> 
> open (my $DATEFILE, "+<", $date_file) ...

Hmmm.  I may give that a try, too!  Thanks!

-- Michael

> -----Original Message-----
> From: deni...@gmail.com [mailto:deni...@gmail.com] On Behalf Of Dan Scott
> Sent: Saturday, March 17, 2012 4:19 PM
> To: Doran, Michael D
> Cc: perl4lib
> Subject: Re: File open head scratcher
> 
> On Sat, Mar 17, 2012 at 3:09 PM, Doran, Michael D <do...@uta.edu> wrote:
> > I am migrating  a perl script from a server running perl v5.8.5 on
> Solaris 9 to a server running perl v5.12.2 on Redhat Linux 5.5.  The new
> environment doesn't seem to like the syntax I'm using to open a file, and
> I'm scratching my head over why that is the case.
> >
> > That part that is not working appears to be where it opens and reads a
> file (a file which it will later append to).  The file that is being
> opened for read and appending exists and contains data.
> >
> > This appears to be the relevant code:
> >
> >  open (my $DATEFILE, "+>>$date_file")
> >        || die "Cannot open $date_file: $!";
> 
> The head-scratching behaviour you describe, where only the system call
> outputs results, matches mine with perl 5.14.2. Maybe there's a
> difference in the versions of perl on your two systems?
> 
> For what it's worth, "Mixing reads and writes" in perlopentut says
> that you probably want:
> 
> open (my $DATEFILE, "+<", $date_file) ...
> 
> (and making that change to my copy of your script makes it work for me).
> 
> --
> Dan Scott
> Laurentian University

Reply via email to