- or download this
%hash = (
name => 'Rhesa',
...
dog => 'Spot',
cat => 'Stofje',
);
- or download this
%pets = (
dog => 'Spot',
cat => 'Stofje',
);
- or download this
%pets = (
dog => $hash{dog},
cat => $hash{cat},
);
- or download this
my @animals = qw( dog cat );
my %pets;
@pets{ @animals } = @hash{ @animals };
- or download this
%pets = map { $_ => $hash{$_} }
qw( dog cat );
- or download this
sub hash_slice {
my ($hr, @k) = @_;
...
# use like this:
%pets = hash_slice( \%hash, qw( dog cat ) );
- or download this
@headers = qw(
firstname lastname
...
title bookcode isbn
quantity
);
- or download this
# %orderline comes from the csv
my $customer = Customer->find_or_create({
firstname => $orderline{firstname},
lastname => $orderline{lastname},
});