Help with select

R

Roger

Can anybody help. I used

select FILEHANDLE;

to set FILEHANDLE as my default output.

I then did a lot of writes to this filehandle and it worked fine, but

I cannot get the default output back to STDOUT

When I try

select STDOUT;

I get an error

undefined format main::STDOUT

How do I get the default output back to STDOUT?

Roger.
 
A

anno4000

Roger said:
Can anybody help. I used

select FILEHANDLE;

to set FILEHANDLE as my default output.

I then did a lot of writes to this filehandle and it worked fine, but

I cannot get the default output back to STDOUT

When I try

select STDOUT;

I get an error

undefined format main::STDOUT

How do I get the default output back to STDOUT?

Read the documentation of the function you're using. In particular,
see the paragraph in "perldoc -f select" that begins "FILEHANDLE may be
an expression ...".

Anno
 
R

Roger

Read the documentation of the function you're using. In particular,
see the paragraph in "perldoc -f select" that begins "FILEHANDLE may be
an expression ...".

Anno

FILEHANDLE may be an expression whose value gives the name of the
actual filehandle. Thus:

$oldfh = select(STDERR); $| = 1; select($oldfh);

I did, and I still get the same error message.

Roger.
 
P

Paul Lalli

Roger said:
Can anybody help. I used

select FILEHANDLE;

to set FILEHANDLE as my default output.

I then did a lot of writes to this filehandle and it worked fine, but

I cannot get the default output back to STDOUT

When I try

select STDOUT;

I get an error

undefined format main::STDOUT

How do I get the default output back to STDOUT?

I find it unlikely that's the real error message. I find it more
likely that the real error message includes a line number. And I'm
willing to bet that the line number the error message refers to is not
the select(STDOUT) line, but a line that attempts to C<write> to the
currently selected filehandle. Except that you didn't define an STDOUT
format. You only defined formats that match the FILEHANDLE you had
previously selected.

In short, logic problem, not syntax problem.

Of course, the above is all pure guesswork, because you haven't showed
us the code that demonstrates the error. Have you read the posting
guidelines for this group? They are posted here twice a week.

Paul Lalli
 
A

anno4000

Roger said:
FILEHANDLE may be an expression whose value gives the name of the
actual filehandle. Thus:

$oldfh = select(STDERR); $| = 1; select($oldfh);

I did, and I still get the same error message.

From the line that says

$oldfh = select(STDERR); $| = 1; select($oldfh);

I doubt it. Show your code.

Anno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,248
Latest member
MagdalenaB

Latest Threads

Top