in reply to Suppressing console output

Hi,
it looks like you need to partly rewrite Script A anyway, so why don't you just add a parameter like --verbose and only output if the script has been called with that parameter?
#!/usr/bin/perl use strict; use warnings; use Getopt::Long; my $verbose; GetOptions( "verbose" => \$verbose ); print "you want output.\n " if $verbose;
gives:
$ perl scriptA.pl --verbose you want output. $ perl scriptA.pl

Alternatively, you could use something like Log::Log4perl and then add a parameter which sets the loglevel to FATAL if you don't want output.
Regards,
svenXY

Replies are listed 'Best First'.
Re^2: Suppressing console output
by loris (Hermit) on Sep 16, 2005 at 09:41 UTC

    Hello svenXY,

    You're right, I could do this, but I'm feeling lazy and don't want to change every line with a print. I'd like to somehow switch the output off globally.

    The idead of using Log::Log4perl is good, although as my scripts are quite short, it could be overkill.

    Thanks,

    loris