Skip to content

Instantly share code, notes, and snippets.

@vst
Created January 29, 2016 22:05
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 vst/04cfdbde8fe15f443d2f to your computer and use it in GitHub Desktop.
Save vst/04cfdbde8fe15f443d2f to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
=head1 NAME
sample.pl - Sample Perl Script
=head1 SYNOPSIS
perl sample.pl
perldoc sample.pl
=head1 DESCRIPTION
This file provides a sample Perl script for reference purposes.
=head1 LICENSE
This is released under the Artistic License. See L<perlartistic>.
=head1 AUTHOR
Vehbi Sinan Tunalioglu - L<http://www.thenegation.com/>
=head1 SEE ALSO
L<perlpod>, L<perlpodspec>
=head1 FUNCTIONS
=cut
## We are using the strict mode:
use strict;
use warnings;
## Define required modules if any:
use DateTime;
## BEGIN Section is executed first during the compilation.
BEGIN {
print STDERR "Starting...\n";
}
## END Section is executed last during the compilation.
END {
print STDERR "Finishing...\n";
}
########################################################################
=head2 C<repeat_message($message, $times)>
Defines a simple function which repeats the provided message a
number of times.
$message: Message to be printed.
$times : Number of times the messages will be printed
Returns : Nothing
=cut
########################################################################
sub repeat_message {
## Read in arguments:
my ($message, $times) = @_;
## Iterate and print messages:
for (my $i = 0; $i < $times; $i++) {
print $message . "\n";
}
}
## Call the subroutine:
repeat_message("Hello World on " . DateTime->today()->ymd(), 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment