in reply to Passing command-line arguments to a file

Ok just discovered the answer. @ARGV must be in this format:
@ARGV = ("-s", "-t", "-H", "-a", "sample.txt", "> sample.html")

The format I had it in, which was incorrect was:
@ARGV = ("-s", "-t", "-H", "-a", "sample.txt", ">", "sample.html");
I was giving the angle bracket it's own set of quotes.

Replies are listed 'Best First'.
Re: Re: Passing command-line arguments to a file
by dws (Chancellor) on Apr 17, 2001 at 11:45 UTC
    If you think you need to pass ">" and "sample.html" as arguments, it seems possible that you don't understand the concept of "I/O Redirection".

    When most modern command interpreters (AKA "shells") see foo -a -b -c > bar They take is as a directive to execute foo, passing the arguments "-a", "-b", and "-c", and arranging for foo's output to be redirected to bar. This means that foo never sees ">" or "bar". Instead, the command interpeter has connived with the operating system to open bar and arranged for foo's "standard output" to go to bar rather than the display.

    Similarly, foo < bar means that foo's "standard input" is bar, rather than the console. The command interpeter (shell) has stripped off the "<" and "bar" and has connived with the O/S to redirect foo's standard input.

    What I suspect this means for you is that you've inherited Someone Else's Code for producing HTML. The script likely writes implicitly to STDOUT. Adding "> sample.html" on the invoking command line tells the shell to direct the script's output to "sample.html".

    The simple way to tell if this is the case is to examine the code for print statements that don't specify a file handle, such as print "<h1>Hi Mom!</h1>\n";

    Update: I looked back over some of nysus's posts, and it seems pretty clear that he does understand I/O redirection. So this is off target for this thread. On target after all.