Some underlining information about the operating system is needed to explain your problem. When typing the command 'df' on your terminal window, your interface to the operating system is a program called a shell. There are many shell programs ( I prefer the korn shell myself ) and each different shell program has it's own definitions of what sequences are correct.

Running your perl script under 'unix' or 'linux', your interface to the operating system is 'perl', but how 'perl' is called also matters. When your perl script calls the operating system with 'system', qx//, backticks etc., you can't be sure that perl will get the exact same results as when you typed it on the command line. Most often the results are the same or similar. (Note: This is why others have mentioned the '$', it has to be escaped to get it to the shell. But shell considerations also matter.)

This is especially true when the perl script is called from 'cron', allowing it to be called on a specific schedule.

Another approach is too change the shell to the same as your Unix system (if it is available).

Good Luck

"Well done is better than well said." - Benjamin Franklin


In reply to Re: print question by flexvault
in thread print question by bp4a

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.