slowmotion
Quite dreadful
- Location
- lost somewhere
Did you wheel the money in a dustbin, Vernon?
That's a cheap shot dudeDid you wheel the money in a dustbin, Vernon?
Did you wheel the money in a dustbin, Vernon?
#!/usr/bin/perl
use strict;
use List::Util 'min';
use Data::Dumper;
my %notesandcoins=( '5000'=>0, '2000'=>0, '1000'=>10, '0500'=>10,
'0100'=>10, '0050'=>4, '0020'=>20, '0010'=>5, '0005'=>50,
'0002'=>100, '0001'=>100);
my $sum=166;
my %change;
for my $value (reverse sort keys %notesandcoins) {
$change{$value}=min int($sum/$value), $notesandcoins{$value};
$notesandcoins{$value}-=$change{$value};
$sum-=$change{$value}*$value;
}
die "Cannot make change" if ($sum);
print Dumper %change;
Every Little Helps, as they say.That's what the small bloke inside the machine had in his hand at the time.
I normally get this warning when I re-use Asda bags in Sainsbury's.'Unexpected item in the bagging area. Please remove item before continuing