On Thu May 19 03:49:55 2005, shay wrote: > > I believe that the following program should print "OK" 5 times over, > but > it prints "NOT OK" for the first line. > #!/usr/bin/perl print qq[>10\n] =~ />\d+$ \n/ix ? "OK\n" : "NOT OK\n"; print qq[>1\n] =~ />\d+$ \n/ix ? "OK\n" : "NOT OK\n"; print qq[>10\n] =~ /\d+$ \n/ix ? "OK\n" : "NOT OK\n"; print qq[>10\n] =~ />\d\d$ \n/ix ? "OK\n" : "NOT OK\n"; print qq[>10\n] =~ />\d+$ \n/x ? "OK\n" : "NOT OK\n"; __END__ 5.8.8: NOT OK OK OK OK OK 5.10/blead: OK OK OK OK OK While checking if a test for it exists/while writing one I decied to check if the /x was needed: #!/usr/bin/perl print qq[>10\n] =~ />\d+$\n/i ? "OK\n" : "NOT OK\n"; print qq[>1\n] =~ />\d+$\n/i ? "OK\n" : "NOT OK\n"; print qq[>10\n] =~ /\d+$\n/i ? "OK\n" : "NOT OK\n"; print qq[>10\n] =~ />\d\d$\n/i ? "OK\n" : "NOT OK\n"; print qq[>10\n] =~ />\d+$\n/ ? "OK\n" : "NOT OK\n"; __END__ Output: NOT OK NOT OK NOT OK NOT OK NOT OK Is this intended/expected behaviour? "a\n" =~ m/a$ \n/x; # true "a\n" =~ m/a$\n/x; # false "a\n" =~ m/a$\n/; # false Kind regards, BramThread Next