eval qq!
if ("$params{'sort'}" eq "date")
{ use Time::Local;
\@messages =
map { \$_->[0] }
sort { \$a->[1] <=> \$b->[1] }
map { my (\$h,\$m,\$d,\$M,\$y) =
\$_->messagedate =~ \/^(\\d{1,2})\\\:(\\d{1,2})
(\\d{1,2})\\\/(\\d{1,2})\\\/(\\d{4})$\/;
[\$_,timelocal(0,\$m,\$h,\$d,\$M-1,\$y) ] }
\@messages; #Schwartzian Magic
} else
{ \@messages =
sort
{ lc(\$a->$params{'sort'}) cmp
lc(\$b->$params{'sort'}) } \@messages;
}
!;
warn $@ if $@;
For some reason, I couldn't sort if from the DB but I needed to sort it properly.
Annika and Els, I'm here for you!
Only question (Score:1)
---ict / Spoon
Re:Only question (Score:1)
Re:Only question (Score:1)
broquaint out
Re:Only question (Score:1)
Re:Only question (Score:1)
broquaint out
Re:Only question (Score:1)
Re:Only question (Score:1)
This is because we're not violating strict in anyway (not symbolic, not bareword, declared variable).
With your hash you can do some slippery scalar dereferencing (to keep it all syntactically correct) or just assign the value to a simple scalar e.g
broquaint out