Yes! It was exactly what I was trying to do. I wasn't so wrong after all.
Thanks you, Dani, your code helps me a lot :D
2006/12/2, D. Bolliger <[EMAIL PROTECTED]>:
Sergio Escalada am Samstag, 2. Dezember 2006 15:41:
> Thanks for replies.
>
> The purpouse of this mini-script is to list the rows
Sergio Escalada am Samstag, 2. Dezember 2006 15:41:
> Thanks for replies.
>
> The purpouse of this mini-script is to list the rows from a database loaded
> in memory ($ref_db is the reference to hashtable that cotains the DB). So I
> want to order the fields by different sort rules, and make the pr
#
# hashref? Why in the WORLD is the database being kept in a hashref?
#
Oh, it's an exercise for class, and I must keep data in a hashtable, it's
not my fault ^_^
Thanks for your code :)
#
# if you have a small number of columns you want to sort by, build a
# simple subroutine to sort by
On 12/02/2006 06:22 AM, Sergio Escalada wrote:
Hi all! I would like to know if it's possible to make an array sorting with
a subroutine call.
Usually, a sort is made as, for example:
sort {$a <=> $b} @array;
But my intention is something like:
sort subroutine_call @array;
sub subroutine
{
> The purpouse of this mini-script is to list the rows from a database loaded
> in memory ($ref_db is the reference to hashtable that cotains the DB). So I
> want to order the fields by different sort rules, and make the proccess as
> abstract as it's possible with a subrutine (sub cmpRule). This s
On 12/2/06, Sergio Escalada <[EMAIL PROTECTED]> wrote:
The purpouse of this mini-script is to list the rows from a database loaded
in memory ($ref_db is the reference to hashtable
Another idea -
sub sortrows {
my $sorted = @_;
$sorted = -(($a->{ahash} eq 'x') <=> ($b->{ahash} eq 'x')) if $
Thanks for replies.
The purpouse of this mini-script is to list the rows from a database loaded
in memory ($ref_db is the reference to hashtable that cotains the DB). So I
want to order the fields by different sort rules, and make the proccess as
abstract as it's possible with a subrutine (sub cm
Sergio Escalada wrote:
Hi all! I would like to know if it's possible to make an array sorting with
a subroutine call.
Usually, a sort is made as, for example:
sort {$a <=> $b} @array;
But my intention is something like:
sort subroutine_call @array;
sub subroutine
{
$a <=> $b;
}
How cou
Sergio Escalada wrote:
Hi all! I would like to know if it's possible to make an array sorting with
a subroutine call.
Usually, a sort is made as, for example:
sort {$a <=> $b} @array;
But my intention is something like:
sort subroutine_call @array;
sub subroutine
{
$a <=> $b;
}
How cou
> Hi all! I would like to know if it's possible to make an array sorting with
> a subroutine call.
>
> Usually, a sort is made as, for example:
>
>
> sort {$a <=> $b} @array;
>
>
> But my intention is something like:
>
>
> sort subroutine_call @array;
>
> sub subroutine
> {
> $a <=> $b;
> }
Sergio Escalada wrote:
Hi all! I would like to know if it's possible to make an array sorting with
a subroutine call.
Usually, a sort is made as, for example:
sort {$a <=> $b} @array;
But my intention is something like:
sort subroutine_call @array;
If you really want to call it like this
11 matches
Mail list logo