"Jenda Krynicky" schreef:

> I see. Well I'd probably get a little lost in all those braces for a
> second so
> 
>   map {
>     $gen->user( {id => $ref->{$_}}, $_)
>   } keys %{$ref}
> 
> would probably be better.

You could write that as: 

   map $gen->user( { id => $ref->{$_} }, $_ ), keys %$ref

Example:

perl -Mstrict -MData::Dumper -wle'

    bless my $gen = {}, "Test";

    my $ref = { a => 1, b => 2 };

    print Dumper map $gen->user( { id => $ref->{$_}}, $_ ), keys %$ref;

    package Test;
    sub user { [EMAIL PROTECTED] }
'

$VAR1 = [
          bless( {}, 'Test' ),
          {
            'id' => 1
          },
          'a'
        ];
$VAR2 = [
          $VAR1->[0],
          {
            'id' => 2
          },
          'b'
        ];

-- 
Affijn, Ruud

"Gewoon is een tijger."

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to