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) ]; } $

In reply to Re^4: how to get Config values into a hash by Aldebaran
in thread how to get Config values into a hash by Aldebaran

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.