in my csv file it'll look like this, and of course it may have more columns
US to UK;abc-hq-jcl;multimedia
UK to CN;def-ny-jkl;standard
DE to DM;abc-ab-klm;critical
FD to YM;la-yr-tym;standard
HY to MC;la-yr-ytm;multimedia
GT to KJ;def-ny-jrt;critical
I would like to group them based on the 3rd column first, then sort them based on 2nd column so it'll look like this
DE to DM;abc-ab-klm;critical
GT to KJ;def-ny-jrt;critical
US to UK;abc-hq-jcl;multimedia
HY to MC;la-yr-ytm;multimedia
UK to CN;def-ny-jkl;standard
FD to YM;la-yr-tym;standard
it would also be nice if somehow I can make it look like this so it'll look more presentable :P,
CRITICAL
DE to DM;abc-ab-klm;critical
GT to KJ;def-ny-jrt;critical
Multimedia
US to UK;abc-hq-jcl;multimedia
HY to MC;la-yr-ytm;multimedia
Standard
UK to CN;def-ny-jkl;standard
FD to YM;la-yr-tym;standard
my @arr=<DATA>;
print map {$_->[0]}
sort {$a->[1]->[2] cmp $b->[1]->[2] or $a->[1]->[1] cmp $b->[1]->[1]}
map {my @tmp=split(";",$_);[$_,\@tmp]}
@arr;
__DATA__
US to UK;abc-hq-jcl;multimedia
UK to CN;def-ny-jkl;standard
DE to DM;abc-ab-klm;critical
FD to YM;la-yr-tym;standard
HY to MC;la-yr-ytm;multimedia
GT to KJ;def-ny-jrt;critical