Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use List::Util 'max';
- use utf8;
- use open qw(:encoding(utf8) :std);
- use feature 'say';
- open my $in, "dat" or die;
- my %h = ();
- while (<$in>) {
- chomp;
- my @b = split;
- next if (!@b or $b[0] =~ /\AItem\z/);
- $h{$b[0]} = ($b[1] + 0) * ($b[2] + 0);
- }
- my $max = max(values %h);
- say join ' ', map { $h{$_} == $max ? ($_, $max) : () } keys %h;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement