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

Discussion in 'Perl' started by Michael W. Cocke, Oct 9, 2003.

  1. 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.


    ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
    Michael W. Cocke, Oct 9, 2003
    #1
    1. Advertising

  2. Michael W. Cocke

    Jim Gibson Guest

    In article <>, Michael W.
    Cocke <> wrote:

    > 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.
    >
    >
    > ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    > http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000
    > Newsgroups
    > ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---


    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?
    Jim Gibson, Oct 9, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrej Litowka

    Enviroment variable on Linux _and_ Windows

    Andrej Litowka, Sep 17, 2003, in forum: C Programming
    Replies:
    2
    Views:
    1,811
    Jack Klein
    Sep 18, 2003
  2. schwerdy
    Replies:
    2
    Views:
    338
    schwerdy
    Oct 27, 2003
  3. Chris Thomasson
    Replies:
    3
    Views:
    418
    Chris Thomasson
    Oct 22, 2007
  4. Dotan Cohen
    Replies:
    2
    Views:
    491
    Dotan Cohen
    Oct 10, 2011
  5. Chris McMahon

    bug in OpenURI#redirectable?

    Chris McMahon, Feb 26, 2007, in forum: Ruby
    Replies:
    0
    Views:
    92
    Chris McMahon
    Feb 26, 2007
Loading...

Share This Page