RosettaCodeData/Task/Repeat/Perl/repeat.pl

11 lines
126 B
Perl
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
sub repeat {
my ($sub, $n) = @_;
$sub->() for 1..$n;
}
sub example {
print "Example\n";
}
repeat(\&example, 4);