Here's an example I made, stripping it down. I didn't get the pseudo-hash error. However, I didn't get any sorting, either. This is almost exactly how I built the bigger thing, which did give me the pseudo-hash error.

scorpion:/export/home/kinyonro-> cat abcd #!/usr/local/bin/perl use strict; use efgh qw(do_thing); my $foo = [ { blah => 'd' }, { blah => 'b' }, { blah => 'c' }, ]; my $sortfunc = sub { $a->{blah} cmp $b->{blah} }; my @bar = do_thing($foo, $sortfunc); for my $hash (@bar) { print "$_ => $hash->{$_}\n" for keys %$hash; print "\n"; } scorpion:/export/home/kinyonro-> cat package efgh; use Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(do_thing); use Data::Dumper; sub do_thing { my ($data, $func) = @_; print Data::Dumper->Dump([$data]); my @bar = sort $func @$data; print Data::Dumper->Dump([@bar]); return @bar; } 1; scorpion:/export/home/kinyonro-> abcd $VAR1 = [ { 'blah' => 'd' }, { 'blah' => 'b' }, { 'blah' => 'c' } ]; $VAR1 = { 'blah' => 'd' }; $VAR2 = { 'blah' => 'b' }; $VAR3 = { 'blah' => 'c' }; blah => d blah => b blah => c

I am very seriously sooooo confused about this. I've never ever worked with pseudo-hashes, and I don't think I ever will. All I know is that they are listrefs where the 0th element is a hashref and the other elements are listrefs. That isn't the case here. (The original data structure was a listref where the 0th element was a listref and the others were hashrefs, but I shifted off the listref, leaving me with a listref of hashrefs. *whimpers*)

In reply to Re: Pseudo-hash intrusion... by dragonchild
in thread Pseudo-hash intrusion... by dragonchild

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