3 Einträge, 1 Seite |
my %id_name ('01'=>'Heiz', '02''=>'Otto', '03''=>'Karl');
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my @ids = qw( 01 02 03);
my @names = ('Heiz','Otto','Karl');
my %hash;
@hash{@ids} = @names;
print Dumper \%hash;
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/perl -w
use strict;
use Data::Dumper;
my @ids = (01,02,03);
my @names = ('Heiz','Otto','Karl');
my %hash = map { $ids[$_], $names[$_] } 0..$#names;
print Dumper \%hash;
3 Einträge, 1 Seite |