in reply to Re: Strange compiler behavior with map?
in thread Strange compiler behavior with map?

The purpose of this statement is to normalize objects and scalar values to their string representation, hence explicit "$_"; I wanted to make it stand out and catch the eye when I will need to return to that code. {; does the trick nicely, thanks.

And many thanks for the second idiom, now that's a real nice solution. I think I've seen it before but somehow it didn't registered until now. I need to remember it the next time.

Regards,
Alex.

  • Comment on Re^2: Strange compiler behavior with map?

Replies are listed 'Best First'.
Re^3: Strange compiler behavior with map?
by Anonymous Monk on Sep 05, 2011 at 09:37 UTC
Re^3: Strange compiler behavior with map?
by ikegami (Patriarch) on Sep 06, 2011 at 00:51 UTC

    Stringifying version:

    my %seen; my @unique = grep !$seen{$_}++, map "$_", @objects;
    my %seen; my @unique = map !$seen{$_}++ ? "$_" : (), @objects;