in reply to Re: Need help with perl syntax.
in thread Need help with perl syntax.

   push @anon, do { $_ => 1 };

push works just fine with a list, you don't need a  do {} block.

push @anon, $_, 1;

Replies are listed 'Best First'.
Re^3: Need help with perl syntax.
by ikegami (Patriarch) on Mar 14, 2008 at 14:17 UTC
    my @y = map { ... } @x;
    is more or less equivalent to
    my @anon; for (@x) { push @anon, do { ... }; } my @y = @anon;

    Yes it can be simplified, which I proceeded to do in the next snippet.

      Yes but you don't need a code block in either case.  my %quick_allow = map { $_ => 1 } @allow_users; could also be written as  my %quick_allow = map( ( $_ => 1 ), @allow_users );.

        Yes, but I wasn't giving the for equiv for map EXPR, LIST, but the syntax he used.