in reply to formatting STDOUT

I'm not sure what you mean by 'STDOUT format' and maybe I'm missing something, but will a simple concatenation operator work for you?

my $output = scalar(localtime()).$system_call; print $output,"\n";

lupey

Replies are listed 'Best First'.
Re^2: formatting STDOUT
by Anonymous Monk on May 31, 2005 at 11:51 UTC
    Im running a binary which returns text - without me being able to do any handling e.g. concatenating strings. I want to change the default formatting to include a timestamp.
      You can capture the output from an executable file by using backticks ``. Then, you can do whatever you want to the output: add a prefix, a suffix, or change it completely with regular expressions. In the following code, I'm capturing the output of echo and prefixing the date. Replace echo with the binary of your choice.
      use strict; my $system_call = `echo hello world`; my $output = scalar(localtime())." $system_call"; print STDOUT $output,"\n"; # output # Tue May 31 09:04:22 2005 hello world

      If this isn't what you are looking for, please be more explicit in your posts.

      lupey