> -----Original Message-----
> From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 27, 2005 8:20 PM
> To: Ryan Frantz
> Cc: beginners perl
> Subject: Re: Block Confusion
> 
> On Sep 27, Ryan Frantz said:
> 
> > # list the processes to hunt for
> > my @findProcesses = (
> >  "putty",
> >  "firefox",
> > );
> >
> > foreach my $process (in
> > $serverObj->InstancesOf("Win32_PerfFormattedData_PerfProc_Process"))
{
> >  foreach my $matchProcess ( @findProcesses ) {
> >    if ( $process->{Name} =~ /$matchProcess/oi ) {
> 
> You're using the /o modifier here, and that's causing your problem.
I'm
> guessing you don't actually know what the /o modifier does.  It tells
Perl
> the regex won't change after it's been compiled the first time.
Remove
> the /o modifier and I believe your code will run fine.

I misunderstood the documentation I read about the /o modifier; I
thought it was necessary for a variable whose value was a regex and then
assumed (yes, due to my ignorance) that the next iteration through the
list would do the same.

I have modified my code and it works as intended.  Thanks for the heads
up.




> 
> --
> Jeff "japhy" Pinyan        %  How can we ever be the sold short or
> RPI Acacia Brother #734    %  the cheated, we who for every service
> http://www.perlmonks.org/  %  have long ago been overpaid?
> http://princeton.pm.org/   %    -- Meister Eckhart

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to