Adding this statement to the begining of our code will trigger warnings for our code wherever relevant. Adding ‘use warnings Fatal => ‘all’; to our code will promote all warnings to errors and die immediately on the first warning.
#!/usr/bin/perl
use strict;
use warnings;
my %currencies = (
USD => 4.1,
EURO => 4.4,
GBP => 6.7
);
my $currency = 'GBP';
if (not exists $currencies{$currency}) {
print("$currency doesnot exist");
} else {
print("$currency exists");
}







