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.


In reply to Re: Re: Passing command-line arguments to a file by dws
in thread Passing command-line arguments to a file by nysus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.