Skip to content

Instantly share code, notes, and snippets.

@umeyuki
Created October 10, 2012 07:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save umeyuki/3863634 to your computer and use it in GitHub Desktop.
Save umeyuki/3863634 to your computer and use it in GitHub Desktop.
同じ組み合わせのサイズは追加しないスクリプト
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