I've been writing a failry complicated data collector with structures as 
deep as 7 levels, and everything worked very nice for me, until I started 
cleaning the subroutine interfaces, so they would pass references back and 
forth instead of working on global vars. The following is a sample code:

use warnings;
use strict;

my %batches = ();

my $current_batch = 'abc';


push @{$batches{$current_batch}{transactions}}, {   trans_num => 'a',
                                                    reference => 'b',
                                                    card_num => 'c'
                                                };

_NASTY_SUB (\%{$batches{$current_batch}});

exit;

sub _NASTY_SUB {

    my ($hashref) = @_;

    foreach my $transaction (@{$batches{$current_batch}{transactions}}) {

        print join (' * ', keys %{$transaction});
        print "\n-------\n";
    }


    foreach my $transaction (@{$hashref}{transactions}) {

        print join (' * ', keys %{$transaction});
        print "\n-------\n";
    }
}


The first foreach in the sub, while using a variable from the main scope 
works like a charm. The second foreach, while working on the reference, 
gives me a warning on something that google only says will be removed as of 
perl 5.10.  What is the actual meaning of pseudo-hashes? To me both foreach 
statements look identical... 


Peter

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


Reply via email to