Hello Sonali

NB this was a reply of yesterday when you had no other useful answers you now have. I put this even if later to add some general consideration. The first one is: generally speaking when you need to know a variable name (what it is after the $ sigil) you are in the wrong direction.

There are two distinct concepts (in regard to retrieve variable from external source): parsing and importing. While the first read some file and based on the content of such file populate some variable the latter (that behind the scene do the same thing) put in the current namespace variable from an external source. Manually do the parsing is generally error prone.

There are different options to save perl datastructure into a file for a later retrieve: you can use Data::Dump output, or Storable Yaml but see the detailed replies about haw muche they are safe.

The very precise monk afoken (read his reply carefully) wrote a useful comparison about different methods of storing/retrieving Perl datastructure: read the thread Data::Dumper JSON Storable YAML differences

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

In reply to Re: Accessing the hash name in perl by Discipulus
in thread Accessing the hash name in perl by Sonali

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.