use warnings; use strict; foreach my $picheight ( 10, 11, 13, 1000 ) { foreach my $picwidth ( 10 .. 20, 1501 ) { my $ratio = $picwidth / $picheight; my $backcolor; if ($picwidth / $picheight > 1.5) { $backcolor="#f5f5f5"; } else { $backcolor="#ffffff"; } my $color1 = ($picwidth / $picheight > 1.5) ? '#f5f5f5' : '#ffffff'; my $color2 = ($ratio > 1.5) ? '#f5f5f5' : '#ffffff'; local $, = "\t"; local $\ = "\n"; print $picwidth, $picheight, sprintf('%8.3f',$ratio), $backcolor, $color1, $color1, ($backcolor eq $color1 ? 'EQ' : 'ERR'), ($color2 eq $color1 ? 'EQ' : 'ERR'); } }