What is {14260:771:0}? You can't assign a hash ref to that.

Let's assume you've got a hash ref with some sensible name ({14260:771:0} isn't a syntactically correct variable name), and you want to extract some data from it. ...In your example, it does look like you're working with a hash ref, not a named hash, so I'll proceed on that assumption.

my $href = { 'allPrices' => [ 8900, 22000 ], 'itemMetrics' => '2:2:20100:0:0:2:30900', 'bidCount' => '0', 'minPrice' => '20100', 'itemClass' => '2', 'buyPrice' => '30900', 'buyCount' => '2', 'numCount' => '2', 'minCount' => '2', 'itemName' => 'Bloodwoven Bracers of the Owl', 'itemPrices' => '8900:22000', 'bidPrice' => '0', 'randomID' => '771', 'baseNum' => '14260', 'mean' => '400', 'median' => '300', 'mode' => '400', 'stdDev' => '100' }; print $href->{stdDev}, "\n"; print $href->{allPrices}[0], "\n";

And the output is:

100 8900

I hope this helps. You will find this much and more in perlintro. This is required reading that will help you prior to following up in this thread with further clarification on your question.


Dave


In reply to Re: some help w/ hashes by davido
in thread some help w/ hashes by rael438

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.