2009/3/11 kevin liu <lwtben...@gmail.com>:
>   �...@array = qx{ps -ef | grep hald-runner};
>    chomp @array;
>    foreach ( @array ) {
>        if (/grep hald-runner/) {
>            next;
>        }
>    }
>
>    Here my confusion comes: What the grep here will mean??
>    Here "grep" is just a plain text or a verb which can help to grep
> contents??

The former. For a part of a regex (or string) to be interpolated (i.e.
regarded as perl syntax rather than string), it should be identifiable
as a variable:

use strict;
use warnings;

my $foo = "blep and grep and snep"; #no interpolation
my $bar = "grep and"; #same
my $baz = "mep and $bar dep"; #$bar identified as variable, interpolated

if ($foo =~ /grep/){ print "'grep' in '$foo'\n";} #not interpolated
if ($foo =~ /$bar/){ print "'$bar' in '$foo'\n";} #interpolated
if ($baz =~ /grep/){ print "'grep' in '$baz'\n";} #not interpolated,
but $baz include interpolated variable $bar



-- 
Erez

It's time to grow out of the browser; we have nothing to lose but our metaphors.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to