in reply to codeopen(INPUT, "<INPUT") gives INPUT opened only for output
Why do you close STDOUT. You can use select instead.
I don't see why you use seek in your code
when you open one filehandle for input and one for
output. If you whould have used +> instead,
you would need the seek. (see perldoc perlopentut).
use POSIX; use strict; my $TRAP=POSIX::tmpnam(); print "TMPFILE is $TRAP\n"; open(TMPFILE, "+> $TRAP") or die $!; select TMPFILE; eval { print 'Waka Waka' }; seek(TMPFILE,0,0); my $input=<INFILE>; close(INFILE>; select STDOUT; print $input;
This works fine for me.
---------------------------
Dr. Mark Ceulemans
Senior Consultant
IT Masters, Belgium
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: codeopen(INPUT, "INPUT") gives INPUT opened only for output
by belg4mit (Prior) on Nov 16, 2001 at 22:08 UTC |