RosettaCodeData/Task/Named-parameters/Perl/named-parameters-1.pl

13 lines
474 B
Perl
Raw Permalink Normal View History

2015-02-20 00:35:01 -05:00
sub funkshun {
my %h = @_;
# Print every argument and its value.
2013-04-10 23:57:08 -07:00
print qq(Argument "$_" has value "$h{$_}".\n)
foreach sort keys %h;
2015-02-20 00:35:01 -05:00
# If a 'verbosity' argument was passed in, print its value
# whatever that value may be.
print "Verbosity specified as $h{verbosity}.\n" if exists $h{verbosity};
# Say that safe mode is on if 'safe' is set to a true value.
# Otherwise, say that it's off.
print "Safe mode ", ($h{safe} ? 'on' : 'off'), ".\n";
}