> 
> if (wantarray) {
>     return @vals;
> }
> else {
>     # create hash where keys are from @heads and values are from @vals
>     # then return a reference to that hash, only when not in list context
>     my %vals;
>     @vals{@heads} = @vals;
>     return \%vals;
> }
> 

try:

my $p = af();
foreach my $key (keys %{$p}){
        print "$key: $p->{$key}\n";
}

sub af{
        my @k = (1,2,3);
        my @p = ('a','b','c');
        return { map { $k[$_] => $p[$_] } 0..$#k };
}

david 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to