Created
October 10, 2012 07:06
-
-
Save umeyuki/3863634 to your computer and use it in GitHub Desktop.
同じ組み合わせのサイズは追加しないスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Data::Dumper; | |
my @banner_size = ( | |
{ | |
width => 320, | |
height => 50 | |
} | |
); | |
my @add_size = ( | |
# 追加される | |
{ | |
width => 300, | |
height => 250 | |
}, | |
# 追加される | |
{ | |
width => 300, | |
height => 100 | |
}, | |
# 重複するので追加されない | |
{ | |
width => 320, | |
height => 50 | |
} | |
); | |
for my $size ( @add_size ) { | |
if ( !grep $_->{width} == $size->{width} && $_->{height} == $size->{height}, @banner_size ) { | |
push @banner_size,{ | |
width => $size->{width}, | |
height => $size->{height} | |
}; | |
} | |
} | |
warn Dumper @banner_size; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment