Leser: 2
|< 1 2 3 >| | 21 Einträge, 3 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
JobNo: 1
input_typ => Integer
input_comment => Hier bitte einen Integer eingeben
comment => Dies ist ein Kommentar
job_template => show_dir
input_name => Variablenname
job_name => Directory anzeigen
JobNo: 2
job_template => show_time
job_name => Serverzeit anzeigen
JobNo: 3
job_template => show_server_info
job_name => Info's über den Server anzeigen
JobNo: 4
job_template => print_const_str
job_name => Konstanten String ausgeben
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
sub print_array_with_inner_hash
{
print "Subroutine print_array_with_inner_hash\n";
my @array2print = @_;
my $result;
my $field;
foreach $ref_zeile (@array2print)
{
print "Zeile: $ref_zeile()";
foreach $key (keys %$ref_zeile)
{
print "Inner hash\n";
if(defined $ref_zeile{$key})
{
print " $key => $ref_zeile{$key}\n";
}
}
print "\n";
}
}
1
2
3
4
5
6
Subroutine print_array_with_inner_hash
Zeile: ()
Zeile: 5/8()
Zeile: 5/8()
Zeile: 5/8()
Zeile: 5/8()
1
2
3
4
5
6
7
8
foreach $key (keys %$ref_zeile)
{
print "Inner hash\n";
if(defined $ref_zeile->{$key})
{
print " $key => $ref_zeile->{$key}\n";
}
}
print_array_with_inner_hash(@jobconf);
1
2
3
4
5
6
7
8
9
$current_job{'job_name'} = $job_name;
$current_job{'job_template'} = $job_template;
$current_job{'comment'} = $comment;
$current_job{'input_name'} = $input_name;
$current_job{'input_typ'} = $input_typ;
$current_job{'input_comment'} = $input_comment;
$jobconf["$job_no"]=\%current_job;
undef %current_job;
1
2
$array[$job_no] = {%current_job}; # lass hier auch die " beim Array weg
undef %current_job;
$jobconf[$job_no]={%current_job};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper; $Data::Dumper::Sortkeys = 1;
my %h1 = (qw/a 1 b 2 c 3 d 4/);
print "Adresse h1 -> ", \%h1, "\n";
print 'h1 : ', Dumper \%h1;
my $h2 = \%h1;
print "Adresse h2 -> ", $h2, "\n";
$h2->{c} = 33;
print 'h1 : ', Dumper \%h1;
print 'h2 : ', Dumper $h2;
my $h3 = { %h1 };
print "Adresse h3 -> ", $h3, "\n";
$h3->{d} = 44;
print 'h1 : ', Dumper \%h1;
print 'h3 : ', Dumper $h3;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Adresse h1 -> HASH(0x1a45960)
h1 : $VAR1 = {
'a' => '1',
'b' => '2',
'c' => '3',
'd' => '4'
};
Adresse h2 -> HASH(0x1a45960)
h1 : $VAR1 = {
'a' => '1',
'b' => '2',
'c' => 33,
'd' => '4'
};
h2 : $VAR1 = {
'a' => '1',
'b' => '2',
'c' => 33,
'd' => '4'
};
Adresse h3 -> HASH(0x1ae0c0c)
h1 : $VAR1 = {
'a' => '1',
'b' => '2',
'c' => 33,
'd' => '4'
};
h3 : $VAR1 = {
'a' => '1',
'b' => '2',
'c' => 33,
'd' => 44
};
|< 1 2 3 >| | 21 Einträge, 3 Seiten |