Reading ARGV _AND_ trying to have redirectable STDOUT ????

  • Thread starter Michael W. Cocke
  • Start date
M

Michael W. Cocke

This is probably incredibly obvious, but I'm just not getting it. I
need to accept an arg (I don't care if it's from getopt or @ARGV).
and I need to be able to print to STDOUT. So far, so good. If I try
to redirect STDOUT to a file (>test.out), the program doesn't output
anything at all (I cannot even tell if it's executing) . If I don't
take the arg from the command line, the STDOUT redirect works fine.

How do I manage both?

Thanks!

Mike-

Mornings: Evolution in action. Only the grumpy will survive.
-----------------------------------------------------

Please note - Due to the intense volume of spam, we have
installed site-wide spam filters at catherders.com. If
email from you bounces, try non-HTML, non-encoded,
non-attachments.
 
J

Jim Gibson

Michael W. said:
This is probably incredibly obvious, but I'm just not getting it. I
need to accept an arg (I don't care if it's from getopt or @ARGV).
and I need to be able to print to STDOUT. So far, so good. If I try
to redirect STDOUT to a file (>test.out), the program doesn't output
anything at all (I cannot even tell if it's executing) . If I don't
take the arg from the command line, the STDOUT redirect works fine.

How do I manage both?

Thanks!

Mike-

Mornings: Evolution in action. Only the grumpy will survive.
-----------------------------------------------------

Please note - Due to the intense volume of spam, we have
installed site-wide spam filters at catherders.com. If
email from you bounces, try non-HTML, non-encoded,
non-attachments.



http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000
Newsgroups

It would be best if you could post your program, reducing it down to
the minimum size that demonstrates the problem. However, please do so
to the newsgroup comp.lang.perl.misc, as this group is defunct.

I have definitely written perl programs that accept command line
arguments and redirected STDOUT to a file, so i know it is possible.
Have you considered explicitly opening a file and writing to it, rather
than redirecting STDOUT?
 

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

Forum statistics

Threads
474,102
Messages
2,570,645
Members
47,247
Latest member
GabrieleL2

Latest Threads

Top