Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: How to get a reference from an eval() string?

by haukex (Chancellor)
on Sep 07, 2016 at 12:43 UTC ( #1171313=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $data = {};
    while (<DATA>) {
    ...
    object.prop.subprop.[1].name = bar
    obj.prop.[0] = blah
    obj.prop.[1] = 1000
    
  2. or download this
    {
      obj => { prop => ["blah", 1000] },
      object => { prop => { subprop => [{ name => "foo" }, { name => "bar"
    + }] } },
    }
    
  3. or download this
    sub dive {
        my ($ref,@path) = @_;
    ...
    print dive( $data, qw/ obj prop [0] / ), "\n";   # prints "blah"
    print dive( $data, qw/ object prop subprop
        [1] name / ), "\n";                          # prints "bar"
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1171313]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2020-04-10 06:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The most amusing oxymoron is:
















    Results (49 votes). Check out past polls.

    Notices?