RE: Block Confusion
- From: RyanFrantz@xxxxxxxxxxxxxxxx (Ryan Frantz)
- Date: Tue, 27 Sep 2005 21:44:49 -0400
> -----Original Message-----
> From: Jeff 'japhy' Pinyan [mailto:japhy@xxxxxxxxxxxx]
> 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
.
- Prev by Date: Re: eval without warnings
- Next by Date: how to make charts using GD
- Previous by thread: Re: Block Confusion
- Next by thread: general retry function
- Index(es):
Relevant Pages
|
|