MrSnrub has asked for the wisdom of the Perl Monks concerning the following question:

I have the following code at the top of my Perl script:
use Data::Dumper; $Data::Dumper::SortKeys = 1;
This gives the following error:
Name "Data::Dumper::SortKeys" used only once: possible typo at hello.p +l line 24.
How do I correct this?

Replies are listed 'Best First'.
Re: Cannot call SortKeys for the Data Dumper
by Athanasius (Archbishop) on Jan 01, 2015 at 15:02 UTC

    Hello MrSnrub,

    The “keys” part of $Sortkeys is all lower case:

    0:59 >perl -MData::Dumper -wE "$Data::Dumper::SortKeys = 1;" Name "Data::Dumper::SortKeys" used only once: possible typo at -e line + 1. 1:00 >perl -MData::Dumper -wE "$Data::Dumper::Sortkeys = 1;" 1:00 >

    Hope that helps,

    Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Re: Cannot call SortKeys for the Data Dumper
by AnomalousMonk (Archbishop) on Jan 01, 2015 at 15:02 UTC

    By using the correct symbol name:  $Data::Dumper::Sortkeys (was 'K' vice 'k'; Perl identifiers are case-sensitive). See Data::Dumper.


    Give a man a fish:  <%-(-(-(-<

Re: Cannot call SortKeys for the Data Dumper
by MrSnrub (Beadle) on Jan 01, 2015 at 15:09 UTC
    That worked great. Thanks!