Leser: 2
|< 1 2 3 >| | 23 Einträge, 3 Seiten |
print $navs{1}[scalar( @{ $navs{$_} } ) ]);
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/perl
use strict;
use warnings;
my @items = qw( Toothbrush Bluetooth Sabretooth Blues Dixie );
my $referer = { 'items' => \@items };
print scalar(@{$referer->{'items'}});
print "\n";
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/perl
use strict;
use warnings;
my @items = qw( Toothbrush Bluetooth Sabretooth Blues Dixie );
my %referer = ( 'items' => \@items );
print scalar(@{$referer{'items'}});
print "\n";
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
my $vPattern = '<!-- navigation_vertikal --><!-- diese Kommentare nicht entfernen! -->';
my $hPattern = '<!-- nav_h --><!-- diese Kommentare nicht entfernen! -->';
my $vPatternEnde = '<!-- /navigation_vertikal --><!-- diese Kommentare nicht entfernen! -->';
my $hPatternEnde = '<!-- /nav_h --><!-- diese Kommentare nicht entfernen! -->';
my @template = extractFile( $main_template );
my $flag = 0; # 0 = init, 1 = vfound, 2 = hfound,
my %navs = ();
my $navcnt = 0;
for my $cnt ( 0 .. $#template ) {
if( $template[$cnt] =~ m/$vPattern/ig or $flag == 1) {
print "v-fopund!<br />\n" if $flag == 0;
$navcnt++ if $flag == 0;
$flag = 1;
push @{ $navs{$navcnt} }, $cnt;
if( $template[$cnt] =~ m/$vPatternEnde/ig ) {
$flag = 0;
print "v-found-ende<br />\n";
}
}
if( $template[$cnt] =~ m/$hPattern/ig or $flag == 2) {
print "h-found!<br 7>\n" if $flag == 0;
$navcnt++ if $flag == 0;
$flag = 2;
push @{ $navs{$navcnt} }, $cnt;
if( $template[$cnt] =~ m/$hPatternEnde/ig ) {
$flag = 0;
print "h-found-ende<br />\n";
}
}
} # for my $cnt ( 0 .. $#template ){}
print Dumper( %navs );
1
2
3
4
5
6
my %data = (
key1 => [ 1..5 ],
key2 => [ 6..20 ],
);
print "Laenge key1: ", scalar(@{ $data{key1} }), "\n";
print "Letzer Index: ", $#{ $data{key1} }, "\n";
print scalar(@{$navs->{$_}});
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/perl
use strict;
use warnings;
my @items = qw( Toothbrush Bluetooth Sabretooth Blues Dixie );
my $referer = { 'items' => \@items };
print "Groesse Array: ", scalar(@{$referer->{'items'}}), "\n";
print "Letztes Element: ", ${ $referer->{'items'} }[$#{ $referer->{'items'} }],"\n";
1
2
3
my $position = $referer->{'items'};
my $lastitem = $#{ $position };
print "Letztes Element: ", ${ $position }[ $lastitem ],"\n";
|< 1 2 3 >| | 23 Einträge, 3 Seiten |