in reply to Re^2: Implicit references? module -> feature -> pragma -> "Perl8" ?
in thread Implicit references? module -> feature -> pragma -> "Perl8" ?

foreach my $id (sort { $id{$a}{m_time} <=> $id{$b}{mtime} } @id) { my $value = $id{$id}{value} or next; # ... }
Or similar. Note that @id by no means means that it is the complete set of keys %id

Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^4: Implicit references? module -> feature -> pragma -> "Perl8" ?
by LanX (Saint) on May 13, 2026 at 14:24 UTC
    That's rather cryptic to me°, please exemplify the data-structures.

    Or just use better names! ;)

    I'm pretty sure that in the end %id is a misnomer, and something like %record or just the name of the corresponding DB.TABLE would be far more appropriate ...

    (update)

    ... cause this looks a lot like a DBI->fetchall_hashref()

    Regarding @id, (again) if it's an array use plural @ids .

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery

    °) I have no ID ... ;-)

      %record sucks if you are processing lots of different data. id is just an example. And yes, 90% of that indead stems (indirectly) from DBI related $sth->fetchrow_hashref ()s, so I likely will have ($tab1, @tab1, %tab1), ($tab2, @tab2, %tab2) etc all eventually combined into the final %rec (or similar).

      Anyway, TIMTOWTDI and I LOVE the possibility to do it like this, cause it is easy to *my* mind. (and being the only perl programmer dealing with the code, I can do whatever I want, and thus I am always right and do not have to argue!)


      Enjoy, Have FUN! H.Merijn
        > TIMTOWTDI ... I LOVE ... easy to my mind.

        and since I'm proposing a pragma protecting legacy code, you are free to keep it this way.

        update

        but I still kind of doubt you are processing a DB.table called "ID".

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        see Wikisyntax for the Monastery