Skip to content

Instantly share code, notes, and snippets.

@hisaichi5518
Created February 25, 2014 10:25
Show Gist options
  • Select an option

  • Save hisaichi5518/9206427 to your computer and use it in GitHub Desktop.

Select an option

Save hisaichi5518/9206427 to your computer and use it in GitHub Desktop.
必ず10個返す
use strict;
use warnings;
use List::Util;
use Test::More;
sub fill {
my ($list) = @_;
my $max = 10;
[@$list, map { undef } 1..($max - scalar(@$list))]
}
is scalar(@{fill([1..10])}), 10;
is scalar(@{fill([1..3])}), 10;
is scalar(@{fill([])}), 10;
done_testing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment