#!/usr/bin/perl ########################################### # In welchen Monat ist MSFT am teuersten? # Mike Schilli, 2002 (m@perlmeister.com) ########################################### use warnings; use strict; use QuoteDB 'quotes.db'; my %per_month; for my $month (1 .. 12) { my $sum = 0; my $count = 0; for my $year (1995 .. 2001) { for my $day (1 .. 31) { $sum += quote("MSFT", $year, $month, $day); $count++; } } $per_month{$month} = $sum/$count; } for my $month (sort { $per_month{$b} <=> $per_month{$a} } keys %per_month) { printf "%02d: %.2f\n", $month, $per_month{$month}; }