Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8231061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:20:57+00:00 2026-06-07T17:20:57+00:00

This is probably an easy question but I can’t figure it out. I have

  • 0

This is probably an easy question but I can’t figure it out. I have a structure that is returned from a routine that, when I print with Data::Dumper, looks like

$VAR1 = {
  'date' => 'May 15, 2012',
  'value' => '0.20'
};

But I can’t get the data out of it. If I try $data{value} I get nothing. I am not that familiar with Perl. Can anyone help me? What am I missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:20:59+00:00Added an answer on June 7, 2026 at 5:20 pm

    Your $VAR1 is a hash ref, not just a hash. So you need to dereference the variable to get at the data:

    $VAR1->{date}
    $VAR1->{value}
    

    This is Perl, so TMTOWTDI (There’s More Than One Way To Do It):

    $$VAR1{date}
    $$VAR1{value}
    

    However, the explicit -> arrow operator is generally easier to understand; the operand on the left is a reference, and the bit on the right accesses it ($hash->[0] for an array ref; $hash->{item} for a hash ref).

    You could use instead:

    my %VAR2 = ('date' => 'May 15, 2012', 'value' => '0.20');
    

    Now you can write:

    $VAR2{date}
    $VAR2{value}
    

    (I could have used both %VAR1 and $VAR1; they’re distinct variables — but that’s extra confusing.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably an easy question but I can't figure out the best answer
This is probably really easy but I can't seem to figure out how to
This is probably a really easy question, but I can't find anything that works.
This is probably an easy question but I can't find the answer... I have
This is probably a stupid question, but I just can't figure out how to
I am new to Rails so this is probably an easy question but can't
This is probably a pretty easy to answer question, but I can't find the
Ok I have a question and it is probably very easy but I can
Quick question- I know this is probably really easy, but my excel skills have
Ok, I think this is probably an easy question but for the life of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.