Re: Sorting an array by a substring of its members

2008-12-15 Thread Christopher Yee Mon
hmm. i just tried it and it worked. I guess it's one of those situations. thanks Christopher John W. Krahn wrote: > Christopher Yee Mon wrote: >> I have an array of strings whose members consist of a number followed >> by a comma followed by a text string >> >&

Re: Sorting an array by a substring of its members

2008-12-15 Thread Christopher Yee Mon
he strings but only sort by the numerical part. Regards Christopher Brian Tillman wrote: > I'm probably missing something, but what's wrong with?: > > sort {$b <=> $a} @array; > > > > On Dec 15, 2008, at 6:33 PM, Christopher Yee Mon > wrote: > >> I

Sorting an array by a substring of its members

2008-12-15 Thread Christopher Yee Mon
I have an array of strings whose members consist of a number followed by a comma followed by a text string e.g. 1,fresh 2,testurl I want to sort by descending numerical order according to the number part so I made this sort subroutine sub by_counter_field { my($a, $b) = @_; $a =~ s/^(.*?),

Question about dereferencing

2008-06-10 Thread Christopher Yee Mon
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I have a bit of Perl homework where we got a code sample. I can see what the code sample is doing except for two little bits There's a part that has $row->[$i] and a part that has @$row . What do these two parts mean? The code sample turns csv