in reply to Re: Re: "foreach" is to "next" as "map" is to ???
in thread "foreach" is to "next" as "map" is to ???

though in sacked's original example there was no do block.
Well, of course there wasn't a do block, because he was showing a foreach loop, and was asking how to do the equivalent using map. You don't need to do {} in the foreach.

But sacked's original example didn't contain multiple nexts. There's also another way of dealing with this problem: a bare block:

my @paragraph = map {;{ next if /^#/; $_ = lc $_; $_ =~ tr/ -~//cd; next if /foobar/; $_ =~ s/administration/admin/g; next if length $_ > 60; $_ }} @lines;

Abigail

Replies are listed 'Best First'.
Re: Re: "foreach" is to "next" as "map" is to ???
by Limbic~Region (Chancellor) on May 26, 2004 at 17:30 UTC
    There's also another way of dealing with this problem: a bare block:

    now that's cool

    Cheers - L~R