in reply to Trap in Test::Unit::Assert? Avoidance

A failed match in list context returns an empty list. So your first line was equivalent to:
$self->assert("warning message here");

Replies are listed 'Best First'.
Re^2: Trap in Test::Unit::Assert? Avoidance
by Jasper (Chaplain) on Mar 10, 2005 at 14:21 UTC
    Yes, absolutely right. My mistake was that I thought a straight match returned a scalar value unless it had //g, or matching parens in the regexp. Live and learn, I suppose.
      Nothing returns a scalar in list context. If it's in list context, it will return a list. Even if it's a single element list. ;-)

      Note that a failing regex in list context returning anything but an empty list would be very inconvenient, as this code is common:

      if (my @matches = $var =~ /PATTERN/) { # match } else { # did not match }
      If the failing match would return undef, 0, or the empty string, the result of the assignment becomes true (because a list assignment in scalar context returns the number of things on the RHS of the assignment).