Tom Phoenix wrote:
On 4/25/06, JupiterHost.Net [EMAIL PROTECTED] wrote:
sort {
$a-value() cmp $b-value()
||
$a-part('Name')-value() cmp $b-part('Name')-value()
}
grep { defined } @objects
But sometimes $a-part('Name') returns undef, so the sort fails.
Hello List,
I have a sort() issue that is a bit odd and any input wouls be most
appreciated :)
The code:
use strict;
use warnings;
...
for my $obj(
sort {
$a-value() cmp $b-value()
||
$a-part('Name')-value() cmp $b-part('Name')-value()
}
grep { defined }
On 4/25/06, JupiterHost.Net [EMAIL PROTECTED] wrote:
for my $obj(
sort {
$a-value() cmp $b-value()
||
$a-part('Name')-value() cmp $b-part('Name')-value()
}
grep { defined } @objects
) {
...
$a/$b-value() always works since if $a/$b is defined
Just a thought, but couldn't you put the logic in your grep statement?
Something like this:
grep {defined($_-value()) or defined($_-part('Name')-value())}
@objects;
-Original Message-
From: JupiterHost.Net [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 25, 2006 12:22 PM
To:
Timothy Johnson wrote:
Just a thought, but couldn't you put the logic in your grep statement?
Something like this:
grep {defined($_-value()) or defined($_-part('Name')-value())}
@objects;
The only problem is then that the object woudl be completely skipped.
I need all objects regardless
Jay Savage wrote:
On 4/25/06, JupiterHost.Net [EMAIL PROTECTED] wrote:
for my $obj(
sort {
$a-value() cmp $b-value()
||
$a-part('Name')-value() cmp $b-part('Name')-value()
}
grep { defined } @objects
) {
...
$a/$b-value() always works since if $a/$b is
On 4/25/06, JupiterHost.Net [EMAIL PROTECTED] wrote:
sort {
$a-value() cmp $b-value()
||
$a-part('Name')-value() cmp $b-part('Name')-value()
}
grep { defined } @objects
But sometimes $a-part('Name') returns undef, so the sort fails.
I need all