I was reading the docs for Finance::Quote and saw some weird syntax described as "two-dimensional hashes." I thought, "That must just be a hash of hashes," and, "I had no idea that syntax would work." Messing around with it I immediately discovered it wasn't an alternative syntax but an entirely different key construction.
In 10 years of Perl I've never seen this and I realize I might be naïve but does anyone have an overview or insight into this? Is this what they're usually called? Are these used in the wild? How long have they been available? Are they in a major document that I've failed to FR?
DB<15>use Finance::Quote; DB<16>$q = Finance::Quote->new; DB<17>%quotes = $q->fetch("nasdaq","lway"); DB<18> use YAML; DB<19> print Dump \%quotes --- "LWAY\x1cask": ~ "LWAY\x1cavg_vol": 19988 "LWAY\x1cbid": 9.05 "LWAY\x1ccap": 208.6M "LWAY\x1cclose": 12.55 "LWAY\x1ccurrency": USD "LWAY\x1cdate": 06/19/2009 "LWAY\x1cday_range": '12.2901 - 12.75' "LWAY\x1cdiv": 0.00 "LWAY\x1cdiv_date": ~ "LWAY\x1cdiv_yield": ~ "LWAY\x1ceps": 0.153 "LWAY\x1cex_div": ' 9-Mar-04' "LWAY\x1chigh": 12.75 "LWAY\x1cisodate": 2009-06-19 "LWAY\x1clast": 12.40 "LWAY\x1clow": 12.2901 "LWAY\x1cname": 'Lifeway Foods, In' "LWAY\x1cnet": -0.15 "LWAY\x1copen": 12.66 "LWAY\x1cp_change": -1.20 "LWAY\x1cpe": 82.03 "LWAY\x1cprice": 12.40 "LWAY\x1csuccess": 1 "LWAY\x1csymbol": LWAY "LWAY\x1ctime": 16:00 "LWAY\x1cvolume": 29649 "LWAY\x1cyear_range": '5.43 - 15.48' DB<20> print $quotes{"LWAY","open"} 12.66 DB<23> $asdf{qw(one two three )} = "OH HAI"; DB<24> print $asdf{"one","two","three"} OH HAI
In reply to Um... WTF? Multi-dimensional hashes by Your Mother
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |