Task

Write a procedure which accepts as arguments another procedure and a positive integer.

The latter procedure is executed a number of times equal to the accepted integer.




sub repeat {
    my ($sub, $n) = @_;
    $sub->() for 1..$n;
}
 
sub example {
    print "Example\n";
}
 
repeat(\&example, 4);