>I would like to sort the same using
> the last field (ie. lward, ohara, dray) starting with
> the 2nd character (ie from ward , hara and ray) :

Check out perldoc sort and perldoc substr.  I think this will do what you
want

@sorted = sort {
        $aname = (split /\s+/, $a)[-1];
        $bname = (split /\s+/, $b)[-1];
        (substr($aname, 1)) cmp (substr($bname, 1)) } <DATA>;

change <DATA> to whatever is getting you your directory listing or a list or
whatever.

Peter C.

Reply via email to