in reply to Program enters infinite loop, can you see why?

Because "@bits[3,5,7]" always includes vwx (7)

Replies are listed 'Best First'.
Re^2: Program enters infinite loop, can you see why?
by BrowserUk (Patriarch) on Dec 07, 2010 at 04:11 UTC

    By that logic, this should also hang, but it doesn't:

    C:\test>perl -wE"1 while 'vwx' =~ m[vwx]g;"

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      interpolation always interpolates
Re^2: Program enters infinite loop, can you see why?
by ikegami (Patriarch) on Dec 07, 2010 at 04:11 UTC

    That doesn't really explain anything. In the following, what you said applies to $x, yet it doesn't loop forever.

    #! perl -slw use strict; my @bits = unpack '(a3)*', 'abcdefghijklmnopqrstuvwxyz'; my $x = "@bits[3,5,7]"; 1 while $x =~ m[vwx]g;