Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Hash slices in assignment

#!/usr/bin/perl 
use strict;
use warnings;


my @fields = qw(fname lname phone);

my @values = qw(Peti Bar 12345);

my %h;
@h{@fields} = @values;


print "$h{fname}\n";   # Peti
print "$h{lname}\n";   # Bar
print "$h{phone}\n";   # 12345