> Suggestion: rather than use egrep (which, as Chas points out, requires
> a new process - and ignoring his solution for a moment - sorry), it
> might make more sense (and increase portability) to move the RegEx
> parsing into Perl.
>
> my $var = grep {/This|That/}, `cmd --arg1 --arg2;
> (Did I do
On Wed, Feb 20, 2008 at 5:50 PM, yitzle <[EMAIL PROTECTED]> wrote:
snip
> my $var = grep {/This|That/}, `cmd --arg1 --arg2;
> (Did I do this right? I'm not very familiar with grep)
snip
That is mostly correct. You are using the grep function in scalar
context, so it will return the number of it
Suggestion: rather than use egrep (which, as Chas points out, requires
a new process - and ignoring his solution for a moment - sorry), it
might make more sense (and increase portability) to move the RegEx
parsing into Perl.
my $var = grep {/This|That/}, `cmd --arg1 --arg2;
(Did I do this right? I
> That should be "one process" not "on process". It is important, and I
> forgot to add this, to use waitpid* to reap the child process after an
> open3 unless you don't mind zombies.
>
> * http://perldoc.perl.org/functions/waitpid.html
Thank you Chas and yitzle
jlc
--
To unsubscribe, e-mail: [
On Wed, Feb 20, 2008 at 5:42 PM, Chas. Owens <[EMAIL PROTECTED]> wrote:
snip
> This code also benefits from the fact that it only spawns on process
snip
That should be "one process" not "on process". It is important, and I
forgot to add this, to use waitpid* to reap the child process after an
op
On both Windows and Unix, there are two output streams, STDOUT and STDERR.
The backtick operator captures the STDOUT and lets you use it eg to set $var.
STDERR is what you are seeing. (Perl's warn prints to STDERR)
What you can do (on Linux machine) is redirect the STDERR to null.
I don't think egr
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 fr
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.
Thank you,
jlc
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://