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.


--
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
.



Relevant Pages

  • Re: Regex for
    ... It works for me, Perl 5.10.0, if you want to include the beginning ... You might find this kind of regex more ... matching will split across lines, ... modifier. ...
    (comp.lang.perl.misc)
  • Re: matching a pattern with a space or no space??
    ... Perl doesn't have that function. ... How can I regex a data flow that is always ... surrounded by optional white space. ... next name and assignment. ...
    (comp.lang.perl.misc)
  • Re: Regexp slowdown
    ... with the same weak logic that you use for the regex stuff. ... cr> What of that makes you think I'm worried about the syntax of my regex? ... cr> memory-intensive attempt at interpreter optimization by the perl folks. ... cr> had a mile-long stack frame I would see a performance hit. ...
    (comp.lang.perl.misc)
  • Re: reg exp
    ... > looked in my learning perl and programming perl books and did not find this ... and "the thing" behaved as a regex should... ... which sums up the number read into $total. ... > Derek B. Smith ...
    (perl.beginners)
  • Re: Tough (for me) regex case
    ... worry about the paired doublequote case) I get a pattern which reads: ... In Perl, the quotes get consumed before the match is constructed. ... Then the regex matches include the quote characters, ...
    (microsoft.public.dotnet.framework)