in reply to reading a log file and sorting by last name

my( $fname, $lname, $grades ) = /^(.*?) (\S*?) ([ 0-9]*)$/;

But I'd probably store the data as an array of arrays, rather than re-joining the string before the sort. I.e.:

for ( sort { $a->[1] cmp $b->[1] or $a->[0] cmp $b->[0] } map { [ /^(.*?) (\S*?) ([ 0-9]*)$/ ] } @lines ) { print "@$_\n"; }
We're building the house of the future together.

Replies are listed 'Best First'.
Re^2: reading a log file and sorting by last name
by Hue-Bond (Priest) on Oct 09, 2006 at 16:01 UTC
    my( $fname, $lname, $grades ) = /^(.*?) (\S*?) ([ 0-9]*)$/;

    Also:

    my ($fname, $lname, $grades) = split /\s+/, $_, 3;

    --
    David Serrano