in reply to Re: How to sort a multidimensional array
in thread How to sort a multidimensional array

Assuming that you have your vocation as the third word
in your array element string and ur strings delimited by exactly
one space characters this also works

@MYarray =( 'Jeff Goldblum Actor', 'Mary Heartman Priest', 'John Ericsson Mathmetician', 'Tony Cisneros Chef' ); @MYarray = map { join " ",@{$_} } sort { $a->[2] cmp $b->[2] } map{[sp +lit "\\s",$_]} @MYarray; use Data::Dumper; print Dumper(\@MYarray),"\n\n"; # your output should look like this .. $VAR1 = [ 'Jeff Goldblum Actor', 'Tony Cisneros Chef', 'John Ericsson Mathmetician', 'Mary Heartman Priest' ];

Replies are listed 'Best First'.
Re^3: How to sort a multidimensional array
by benperl (Initiate) on Jul 11, 2006 at 16:50 UTC
    This is great - I'm now trying to figure out how to get it to work with a comma-delimited array:
    Jeff,Goldblum,Actor Mary,Heartman,Priest John,Ericsson,Mathmetician Tony,Cisneros,Chef
    A reply falls below the community's threshold of quality. You may see it by logging in.