http://qs321.pair.com?node_id=912025


in reply to Infinite regex loop...

Because $SIRtrue is true whenever /SPECint_base/ matches, this line:

if ($SIRtrue && !($_ =~ /SPECint_base/)){

is equivalent to:

if ($SIRtrue && !$SIRtrue){

That "if" statement can never be true. A similar argument applies to the final "if" statement. No assignment will ever be made to the %SIR or %SFR hashes.

You might also wish to note that regex matches in Perl are performed by default on the $_ variable. See perlretut. So you can replace:

if ($_ =~ /SPECint_base/){

with this:

if (/SPECint_base/){

Update: of course limzz's reply is correct. But we still have not heard from the OP exactly what the behaviour of the program is. There is nothing in the code shown to cause an infinite loop.