in reply to Re: Re: undefined question
in thread undefined question

As for the greps externally - I recall finding this in a perl tutorial many moons ago, and never learned it another way. Might you have a link that explains it internally?

You'd find that described under "regular expressions". As an example,

open(PROCS, "ps -a | grep $process |"); while ( my $proc = <PROCS> ) { # ... }
can be rewriten (assuming $process holds an alphanumeric string) as
open(PROCS, "ps -a |"); while ( my $proc = <PROCS> ) { next if $proc !~ /$process/; # ... }
Regular expressions are your friends. Learning about them pays off in many ways.

Replies are listed 'Best First'.
Re: Re: Re: Re: undefined question
by Anonymous Monk on Jun 09, 2003 at 06:39 UTC
    I've actaully been playing w/ regular expressions a bit lately. I wouldn't have thoght of using them w/ this though - this is pretty easy, after I got over my initial hurdle. They're still a bit foreign, but after reading (and asking) here, I've gotten them to do some pretty helpful things. Again - thanks for the wisdom