in reply to sorting question
The above achieves what I wanted.#!/usr/bin/perl while (<>) { $str .= $_; } @lines = split ("\n", $str); @sorted = sort fooSort @lines; foreach $line (@sorted) { print ("$line\n"); } sub fooSort { my @a = split '\|', $a; my @b = split '\|', $b; $a[0] cmp $b[0] || $b[1] <=> $a[1] }
|
|---|