On Jan 29, 2008 7:45 AM, Harry Bennett <[EMAIL PROTECTED]> wrote:
> I am using this line:
>
> foreach my $pair (keys %{$config{server}}) {
> .....
> }
>
> but get the warning:
>
> Pseudo-hashes are deprecated at ......
>
> I am using the example from 'Programming Perl (third edition)' Section 9.4.3
>
> I guess my ultimate question would be, what have they been deprecated to?
> And an example would be GREATLY appreciated.
snip

The error is being printed at that line, but its cause is earlier in
your code.  The following code has no error

#!/usr/bin/perl

use strict;
use warnings;

my %config = (
        server => { one => 1, two => 2, three => 3 }
);

foreach my $pair (keys %{$config{server}}) {
        print "$pair\n";
}

The error is really the use of pseudo-hashes.  They have not been
replaced with anything because they turned out to be a bad idea.  The
goal was to have the speed of an array, but the easy of use of a hash.
 The implementation wound up doing neither and cluttering up the
source*.  The other feature of pseudo-hashes, the compile time
checking of the keys, has been preserved in the fields pragma**.

* from http://use.perl.org/article.pl?sid=01/07/16/127257
     The extra code to support pseudo-hashes slowed down all arrays
and hashes by 10 to 15%.
** see perldoc fields or http://perldoc.perl.org/fields.html

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to