🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #13544

Re: Una de PERL.

#13544
From: Juan Salvador
Date: Fri, 16 Feb 2001 17:44
35 lines
1873 bytes
Hola de nuevo, me respondo a mi mismo:

@ordenada = sort { $a->{cod} <=> $b->{cod} } @mimatriz;


Juan Salvador wrote:

> Hola a todos.
> 
> He estado investigando sobre el funcionamiento de la funcion sort en perl
> y no veo claro como puedo ordenar un array de hashes. El codigo que genera
> el array es algo asi:
> 
> my @mimatriz = ();
> 
> bucle1 { # Por abreviar ...
>   my %registro;
> 
>   $registro{cod} = ObtenerCodigo;
>   $registro{datos} = ObtenerDatos;
> 
>    push(@mimatriz, \%registro);
> }
> 
> �Como puedo ordenar @mimatriz por cod ($mimatriz[$indice]{cod}) mediante
> la funcion sort?. �Alguien lo sabe?
> 
> Muchas gracias a todos por anticipado.

-- 
-----------------------------
Juan Salvador Perez Garcia
e-mail: jperez@es.wanadoo.com
I+D -- Herramientas Internas
-----------------------------
Technical Details
Message-ID: <96jovp$52i$1@m2wpersoisp01.wanadoo.es>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!grolier!fr.clara.net!heighliner.fr.clara.net!opentransit.net!newsfeed.comtenidos.com!m2newsfeeder01!not-for-mail
References: <96j7ht$itn$1@m2wpersoisp01.wanadoo.es>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,dff003dcc58d9ee5
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2001-02-16 10:02:05 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!grolier!fr.clara.net!heighliner.fr.clara.net!opentransit.net!newsfeed.comtenidos.com!m2newsfeeder01!not-for-mail
From: Juan Salvador <salva.perez@ctv-jet.com>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Una de PERL.
Date: Fri, 16 Feb 2001 18:44:59 +0100
Organization: Wanadoo
Lines: 36
Message-ID: <96jovp$52i$1@m2wpersoisp01.wanadoo.es>
References: <96j7ht$itn$1@m2wpersoisp01.wanadoo.es>
Reply-To: jperez@es.wanadoo.com
NNTP-Posting-Host: nat.ctv.es
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8Bit
X-Trace: m2wpersoisp01.wanadoo.es 982345529 5202 212.25.128.2 (16 Feb 2001 17:45:29 GMT)
X-Complaints-To: usenet@m2wpersoisp01.wanadoo.es
NNTP-Posting-Date: Fri, 16 Feb 2001 17:45:29 +0000 (UTC)
User-Agent: KNode/0.3.3