Peter,
Thanks for your reply. My responses are in-line below.
Rob
--- Peter Scott <[EMAIL PROTECTED]> wrote:
> In article <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED] (Rob Richardson) writes:
> >sub GetTrainsByTime
> >{
> > my $self = shift;
> > my @result;
> > my @temp;
> > my $aTrain;
> > my $aTrainName;
> >
> > # First we build a temporary array of references to trains
> > foreach $aTrainName (keys $self)
> ^ % missing
> > {
> > push @temp, $self{aTrainName};
> ^ $ missing
>
> > }
> >
> > @result = sort {$a->GetCrewCall() cmp $b->GetCrewCall()} @temp;
> > return @result;
> >}
>
> (1) If you wanted to put the keys of a hash into an array, just do it
> all at once:
>
> @temp = keys %$self
I am not putting the keys of the hash into the temporary array. I'm
putting the values of the hash into the array.
>
> (2) If you want to sort the keys of a hash, there's no need to put
> them into an array. sort takes a list as input:
>
> return sort { $a->GetCrewCall cmp $b->GetCrewCall } keys %self
>
Since I am not using the keys of the hash, the above line won't work
for me.
__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]