How add values to %hash in perl?

It’s as follows:

#!/usr/bin/perl
use strict;
use warnings;
use v5.10;

my @a=(1,2,3,4,5,6,9);
my @b=('q','w','e','r','t','y','u');
my %hash;
for(my $i=0;$i<7;$i++)
{
  $hash{$a[$i]}=$b[$i];
}

print $hash{'9'};

O/p

u

Leave a Reply