sub print_multiple {
my ($count, $string, $format) = @_;
for (1..$count) {
print &format_string ($string, $format), "\n";
}
return;
}
sub format_string {
my ($string, $format) = @_;
my %templates = (
'bold' => '%s',
'italic' => '%s',
);
return (sprintf ($templates{$format}, $string));
}
&print_multiple (5, 'hello, world.', 'bold');