phillips@cs.ubc.ca (George Phillips) (02/13/90)
It seems that when perl does the wrong thing when it executes the !~ operator and the evaluator expects it to return an array. Running perl -e 'print "foo" !~ /f/;' gives "1" while perl -e 'print !("foo" !~ /f/);' gives "1" as well(!) The following fragment from eval.c should do something to "NOT" the array if gimme == G_ARRAY. case O_NMATCH: sp = do_match(str,arg, gimme,arglast); if (gimme == G_ARRAY) goto array_return; /* forgot to put the ! in !~ */ str_sset(str, str_true(str) ? &str_no : &str_yes); STABSET(str); break; I guess you could either set the number of elements to 0 if there are any and set the number to 1 if there aren't. Actually, does returning an array for !~ make any sense? False would be good enough if you matched, but what do you return when you don't match? A partial match based on the longest substring that matched? George Phillips phillips@cs.ubc.ca {alberta,uw-beaver,uunet}!ubc-cs!phillips -- I told him that I was a flop with scripts I've been this way since 1986 He stretched out his palm and he made a magic sign He said "What you need, boy, is patch level #9"