Associative array/Creation: Difference between revisions
Content added Content deleted
Line 18: | Line 18: | ||
# using , both key and value need to be quoted if containing something non-numeric in nature |
# using , both key and value need to be quoted if containing something non-numeric in nature |
||
my %hash = ( |
my %hash = ( |
||
'key1' |
'key1', 'val1', |
||
'key-2' |
'key-2', 2, |
||
'three' |
'three', -238.83, |
||
4 |
4, 'val3', |
||
); |
); |
||
Line 48: | Line 48: | ||
@hash->{'key1', 'three'} = ('val1', -238.83); |
@hash->{'key1', 'three'} = ('val1', -238.83); |
||
==[[Ruby]]== |
==[[Ruby]]== |