in reply to map weirdness

I'm guessing you need to change this part:
[@{$d[$mapkey]}] if $d[$mapkey]->[1] =~ /$a[$_]/
That generates an undef when the match fails, and shallow-copies the arrayref $d[$mapkey] when the match succeeds. Sounds like you want something more like (untested):
$d[$mapkey]->[1] =~ /$a[$_]/ ? [@{$d[$mapkey]}] : ()
to provide an empty list when the match fails. Using ?: in a map is a common idiom.

Replies are listed 'Best First'.
Re^2: map weirdness
by insaniac (Friar) on Dec 13, 2004 at 12:57 UTC
    thanx dude!!!
    /me hides in shame again... i could have come up with this myself :-$
    --
    to ask a question is a moment of shame
    to remain ignorant is a lifelong shame