Er, self-correction self-correction:

> First:
>     /5/ =~ "line 5";
> 
> is done in list context.

More accurately, something like:

    $_ = "line 5";
    @onemap = (/5/);
    push (@allmaps, @onemap);

where @onemap is really an unnamed internal list not
available to your perl code and @allmap is really an
unnamed internal list which is returned as the result
of the original map call.

One thing that's probably worth adding. It doesn't
often make sense to use regex matching as part
of a map call, because the individual regex matches
called in list context return only undef or (1), which
isn't often that useful. In general, consider grep
instead.

Reply via email to