in reply to Re^2: how to get Config values into a hash
in thread how to get Config values into a hash

print Dumper $ref_Config; # print() on unopened filehandle Dumper

Looks like you're missing use Data::Dumper; at the top of the script. The error message is a little confusing because Perl is trying to interpret that print as Indirect Object Syntax (print FILEHANDLE LIST).

Other than that, looks like you've figured out @INC, and I already pointed out %INC, which will give you the location of the file that was actually loaded.

Replies are listed 'Best First'.
Re^4: how to get Config values into a hash
by Aldebaran (Curate) on Oct 25, 2018 at 06:04 UTC
    print FILEHANDLE LIST

    Thx haukex for the precise explanation. I like to finish my threads with working code, for myself and presumably others who will search the net for why Data::Dumper doesn't work unless you 'use' it. They give a pretty good example here, and I wish that all modules would give example code snippets:

    $ ./1.dd.pl $VAR1 = [ { '81' => 'QQQ', '80' => 'PPP', '79' => 'OOO', '78' => 'NNN', '77' => 'MMM', '76' => 'LLL', '75' => 'KKK', '74' => 'JJJ', '73' => 'III' }, { '75' => 'KKK', '79' => 'OOO', '77' => 'MMM', '81' => 'QQQ', '73' => 'III' }, { 'III' => '73', 'JJJ' => '74', 'KKK' => '75', 'LLL' => '76', 'MMM' => '77', 'NNN' => '78', 'OOO' => '79', 'PPP' => '80', 'QQQ' => '81' } ]; $ cat 1.dd.pl #!/usr/bin/perl -w use 5.011; use Data::Dumper; $Data::Dumper::Sortkeys = \&my_filter; my $foo = { map { (ord, "$_$_$_") } 'I'..'Q' }; my $bar = { %$foo }; my $baz = { reverse %$foo }; print Dumper [ $foo, $bar, $baz ]; sub my_filter { my ($hash) = @_; # return an array ref containing the hash keys to dump # in the order that you want them to be dumped return [ # Sort the keys of %$foo in reverse numeric order $hash eq $foo ? (sort {$b <=> $a} keys %$hash) : # Only dump the odd number keys of %$bar $hash eq $bar ? (grep {$_ % 2} keys %$hash) : # Sort keys in default order for all other hashes (sort keys %$hash) ]; } $