in reply to Re: Hash newbie
in thread Hash newbie

(FX: perldoc perldata). Aha! I have achieved a limited form of enlightenment. Thank you for endulging my laziness ;)

Replies are listed 'Best First'.
Re^2: Hash newbie
by revdiablo (Prior) on Jan 28, 2005 at 18:28 UTC

    ikegami explained that this uses a hash slice. He also showed an equivalent snippet that has the same effect as yours. But I'd like to show an equivalent snippet that might help you understand how the hash slice is doing its job:

    my %h = (); # @h{@FIELDS} = @row; ($h{$FIELDS[0]}, $h{$FIELDS[1]}, $h{$FIELDS[2]}, ...) = ( $row[0] , $row[1] , $row[2] , ...); $result = \%h;

    As you can see, a hash slice is simply a convenient syntax for doing something that is not altogether very complicated. Hopefully this helps you understand it.