Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Recover a path from a config file

by hippo (Bishop)
on Jun 07, 2016 at 13:55 UTC ( [id://1165075]=note: print w/replies, xml ) Need Help??


in reply to Re: Recover a path from a config file
in thread Recover a path from a config file

It doesn't work . I would like to understand. Did i forget something?

Just these:

  • A detailed specification of the way in which it "doesn't work"
  • The precise, full text of the error message you received
  • An SSCCE demonstrating the problem in a reproducible manner

Without these the problem could simply be a typo in your code and nobody would ever know. Help others to help you.

Replies are listed 'Best First'.
Re^3: Recover a path from a config file
by Chaoui05 (Scribe) on Jun 07, 2016 at 14:37 UTC

    Yes . Much for me. I forgot output:

    When i do :

    my $firstName = $config->{name};

    I get the following output :

    Use of uninitialized value $firstName in print atline 115.

    And when i do that :

    my $firstName = ${$config->{programs}}[1];

    i get output below :

    HASH(0x3e25178)

    If i do :

    my $firstName = ${$config->{programs}}[0];

    i obtain in my output:

    VIKTOR DESCRIPTION PRODUCT
    *****Lost in translation****TIMTOWTOI****

      Well, that's a start for sure. Since you still haven't provided an SSCCE, here's one:

      #!/usr/bin/env perl use strict; use warnings; my $config = { programs => [ 'VIKTOR DESCRIPTION PRODUCT' => { name => 'VIKTOR ', parameters => [ Count_id => '06 (Viktor)', ] } ] }; print $config->{programs}->[1]->{name} . "\n";

      IMHO that config file is a mess. Running it with a do or an eval is dangerous as others have mentioned and its structure is arcane at best. I hope for your sake that it's all some big XY problem and the actual task can be solved in an entirely different manner.

        ^^. Thanks it's perfect .

        It works . But i added this variable however :

        my %programs = @{ $config->{programs} };
        *****Lost in translation****TIMTOWTOI****

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2024-03-28 10:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found