Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I'm sorry, but I don't fully understand what you're trying to do. It would be best if you could explain more, with a runnable SSCCE, example input and expected output. Otherwise I am left guessing, for example, based on your code it's not clear to me what @abc contains. Is this a list of commands you want to run, or is it the output of another command? If it's the latter, note that the other monks have already shown you how to handle that, like Discipulus's post here. How are you running the external command, from the command line with the input piped to the Perl script like in the gnomon example (which my code handles), or do you want to invoke the external command from inside the Perl script? If it's the latter, note that my code might not be the best way to do this, and you might need to switch to a module like IPC::Run.

Is this possible to make it a subroutine and call it by default in all STDOUT?

Are you asking how you can modify your own Perl script's output to prefix it with the current time (like a log), instead of another program's output?


In reply to Re^3: How to Prepending a timestamp to each line of output from a command by haukex
in thread How to Prepending a timestamp to each line of output from a command by jnarayan81

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-20 15:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found