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 efgh.pm 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

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.