Title: why no warning about this infinite loop

# run using e.g. echo hello | perl this-file

# Why doesn't perl produce a warning from the following.  It is an
# infinite loop.  If I add a /g modifier to the m// it works fine.

while (<>) {
    while (m/([a-z])/) { # warning infinite loop!!!
        print $1, "\n"
    }
}
   

/// 

In general it is hard to detect infinite loops, but in this case it is easy,
because the pattern is a constant.  I think this is a very common
special case, and is worth detecting.

Why isn't this done?

I am running perl 5.8

Steve

_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to