Regex joy or not?

sky on 2001-05-25T14:16:51

Most defintly not!
Dan Sugalski correctly poined out that my test with match variables didn't proove anything, it boiled down to me missunderstanding how the match variables are scoped. So I whipped up another test that also seems to show (not proove) that regex match variables are not shared. my $i = 1000000; $foo = "bar"; push @threads, IThread->create(sub { for (1..$i) { $foo =~/(.)/; print "error\n" if($1 ne 'b')}}); push @threads, IThread->create(sub { for (1..$i) { $foo =~/(.)/; print "error\n" if($1 ne 'b')}}); push @threads, IThread->create(sub { for (1..$i) { $foo =~/.(.)/; print "error\n" if($1 ne 'a')}}); push @threads, IThread->create(sub { for (1..$i) { $foo =~/.(.)/; print "error\n" if($1 ne 'a')}}); push @threads, IThread->create(sub { for (1..$i) { $foo =~/..(.)/; print "error\n" if($1 ne 'r')}}); push @threads, IThread->create(sub { for (1..$i) { $foo =~/..(.)/; print "error\n" if($1 ne 'r')}}); This does not give an error on my SINGLE cpu box. I am still waiting for somone with a multipel CPU box to try it out.

Artur