Perl snippets
Monday, March 19th, 2007Sort numeric table:
my @tab = sort { $a <=> $b } @{ $results->{$transaction} };
Create classes:
sub new {
my $class = shift;
my $self = { %OPTIONS, @_ };
return bless $self, ref $class || $class;
}
Useful one-liner:
my $sum = eval(join "+", @tab);