#!/usr/bin/perl
use strict;
use warnings;
my %hash = ('1' => 'Perl','2' => 'Linux','3' => 'Bioinformatics');
my $key = shift or die "Key not found\n";
if($key){
print "$hash{$key}\n";
}
Result
$ perl blog.pl 1
Perl
$ perl blog.pl 2
Linux
$ perl blog.pl 3
Bioinformatics
$ perl blog.pl
Key not found
0 comentários:
Post a Comment