#!/usr/bin/env perl use strict; use warnings; open my $fh, '<', 'test_file.txt' or die 'Can not open file'; my %data; while(<$fh>){ chomp $_; my ($key, $val) = split(/\|/, $_); $data{$key} += $val; } foreach my $key ( sort { $a <=> $b } keys %data ){ print "the total is: (".$data{$key}.")\n"; } exit;
In reply to Re: array of arrays
by kevbot
in thread array of arrays
by virtualweb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |