in reply to Data Structure
Output:echo "Student Id Class John 23 2 Mark 33 3 Jerry 44 2 Sam 55 2 Tom 65 3 " | perl -ane '$F[2]=~/^\d+$/ or next;push @{$h[$F[2]]},$F[0]}{ $h[$_] + && print qq|Class $_ = |,join(",",@{$h[$_]}),qq|\n| for 0..$#h'
UPDATE: FWIW, the Data structure used in the code above is an "Array of Array(ref)s".Class 2 = John,Jerry,Sam Class 3 = Mark,Tom
"Software interprets lawyers as damage, and routes around them" - Larry Wall
|
|---|