Gossamer Forum
Home : Products : DBMan : Customization :

Perl question re: default.cfg

Quote Reply
Perl question re: default.cfg
I'm learning Perl. Could someone explain this default.cfg (aka db.cfg) code fragment to me? It's located near the very end of the default.cfg module of Dbman.

foreach (sort { $db_def{$a}[0] <=> $db_def{$b}[0] } keys %db_def) { ...<action>...

I'm particularly clueless about the function of the "{ $db_def{$a}[0] <=> $db_def{$b}[0] }" portion. How are {$a} and {$b} used?

Thanks. Jim



Quote Reply
Re: Perl question re: default.cfg In reply to
I know how to use them, but I don't know how to explain them.

I think that {$a} and {$b} are references to the subscripts of the hash. But I'm not really sure.

You might try asking in the Perl/CGI forum.


------------------
JPD