1 Eintrag, 1 Seite |
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#! /usr/bin/perl
use warnings;
use strict;
my $array = TieVariable();
for (0..5) {
print "$_: $array->[$_]\n";
} # for
$array->[6] = 1000;
untie $array;
# ------------------------------------------------------------
sub TieVariable {
tie my @array, 'Tie::Excel::Array';
$array[$_] = 5 * $_ for 0..5;
return \@array;
} # TieVariable
# ============================================================
package Tie::Excel::Array;
sub TIEARRAY {
my( $class ) = @_;
return bless [], $class;
} # TIEARRAY
# ------------------------------------------------------------
sub STORE {
my( $self, $index, $value ) = @_;
warn "STORE: \$self->[$index] = $value;\n";
$self->[$index] = $value;
} # STORE
# ------------------------------------------------------------
sub FETCH {
my( $self, $index ) = @_;
warn "FETCH: \$self->[$index] = $self->[$index];\n";
return $self->[$index];
} # STORE
# ------------------------------------------------------------
sub FETCHSIZE {
my( $self ) = @_;
return $#$self;
} # FETCHSIZE
# ------------------------------------------------------------
sub UNTIE {
my( $self ) = @_;
warn "UNTIE\n";
} # UNTIE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
my @array = TieVariable();
for (0..5) {
print "$_: $array[$_]\n";
} # for
$array[6] = 1000;
untie @array;
# ------------------------------------------------------------
sub TieVariable {
tie my @array, 'Tie::Excel::Array';
$array[$_] = 5 * $_ for 0..5;
return @array;
} # TieVariable
our @F; *F = \@MyPackage::Array1;
1
2
3
4
5
foreach my $person ( $self->persons_from_PerlCommunity_de ) {
if( $person->can( 'CelebrateXmas' ) {
$person->WishHappyXmas;
}
}
1 Eintrag, 1 Seite |