Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

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

by haukex (Archbishop)
on Sep 07, 2016 at 12:43 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1171313]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-20 05:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found