limzz has asked for the wisdom of the Perl Monks concerning the following question:
Hi all, The following code is a snippet from a script I'm writing. It seems like the regex is caught in an infinite loop or something. I can't even think clearly right now, so maybe it's something simple, but I cannot for the life of me figure out what the hell is going on. Thanks in advance.
while (<FILE>){ chomp; if ($_ =~ /SPECint_base/){ $SIRtrue = 1; $SFRtrue = 0; } if ($_ =~ /SPECfp_base/){ $SIRtrue = 0; $SFRtrue = 1; } if ($SIRtrue && !($_ =~ /SPECint_base/)){ $SIR{$_}=$_; } if ($SFRtrue && !($_ =~ /SPECfp_base/)){ $SFR{$_}=$_; } }
Clarification: This is supposed to find SPECint_base or SPECfp_base, NOT put them in %SIR or %SFR, then put every line from FILE into a hash until the respective 'true' is false. Second clarification: Maybe it's not an infinite loop, but the script is getting stuck. I've tried putting print statements to debug and it seems to be stuck on the first regex.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Infinite regex loop...
by graff (Chancellor) on Jun 30, 2011 at 04:21 UTC | |
Re: Infinite regex loop...
by wind (Priest) on Jun 29, 2011 at 20:47 UTC | |
by limzz (Novice) on Jun 29, 2011 at 21:04 UTC | |
by wind (Priest) on Jun 29, 2011 at 21:43 UTC | |
Re: Infinite regex loop...
by philipbailey (Curate) on Jun 29, 2011 at 20:00 UTC | |
by tj_thompson (Monk) on Jun 29, 2011 at 22:01 UTC | |
by limzz (Novice) on Jun 29, 2011 at 20:23 UTC |