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.
Back to
Seekers of Perl Wisdom