On Wed, Feb 20, 2008 at 5:18 PM, Joseph L. Casale <[EMAIL PROTECTED]> wrote: > How does one do this? I have the output in a script set to a variable such as: > my $var = `cmd --arg1 --arg2 | egrep 'This|That'` and I don't want to see it > as the script is run. snip
Supressing output on STDERR from the qx// operator is shell dependent. If you are using a UNIX-like shell you can say my $var = `cmd --arg1 --arg2 2>/dev/null | egrep 'This|That'`; but the most portable option is to use IPC::Open3*: #!/usr/bin/perl use strict; use warnings; use IPC::Open3; my $pid = open3(my $in, my $out, (my $err = 1), "cmd", "--arg1", "--arg2") or die "could not run perl bar.pl: $!"; my $var = ''; while (<$out>) { next if /This|That/; $var .= $_; } This code also benefits from the fact that it only spawns on process (cmd) instead of three (the shell, cmd, and egrep). * http://perldoc.perl.org/IPC/Open3.html -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/