Using the if statement to check the command line parameters
#!/usr/bin/perl -w
use strict;
sub version {
print "version\n";
}
my $option = shift; # defaults to shifting @ARGV
version() if $option eq "-v" or $option eq "--version";
print "Hello, world.\n";