PDA

View Full Version : difference between hash and hash ref in perl



monkeyking
March 9th, 2007, 09:05 PM
Could someone elaborete on the difference between hash's and hash references in perl.

And when to use what?

Thanks in advance

Mr. C.
March 9th, 2007, 11:32 PM
A hash is a basic data type in Perl. It uses keys to access its contents.

A hash ref is an abbreviation to a reference to a hash. References are scalars, that is simple values. It is a scalar value that contains essentially, a pointer to the actual hash itself.

Got it?

MrC

monkeyking
March 10th, 2007, 01:18 AM
yes,
pointer was the magic word
thanks.