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

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****

Replies are listed 'Best First'.
Re^4: Recover a path from a config file
by hippo (Archbishop) on Jun 07, 2016 at 14:57 UTC

    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****