Skip to content

Instantly share code, notes, and snippets.

@tokubass
Forked from umeyuki/non_overlap.pl
Created October 17, 2012 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tokubass/3903728 to your computer and use it in GitHub Desktop.
Save tokubass/3903728 to your computer and use it in GitHub Desktop.
同じ組み合わせのサイズは追加しないスクリプト
use strict;
use warnings;
use Data::Dumper;
my @banner_size = ({
width => 320,
height => 50,
});
my $is_existing_size;
for my $size (@banner_size) {
my $key = join('-', $size->{widht}, $size->{heigth} );
$is_existing_size->{$key} = 1;
}
my @add_size = ({
width => 300,
height => 250,
},{
width => 300,
height => 100,
},{
width => 320,
height => 50,
});
for my $size ( @add_size ) {
my $key = join('-', $size->{widht}, $size->{heigth} );
unless ( $is_existing_size->{$key} ) {
push @banner_size, $size
$is_existing_size->{$key} = 1;
}
}
warn Dumper \@existing_banner_size;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment