Thread Array als Objektvariable (6 answers)
Opened by Robse at 2005-08-29 19:13

Taulmarill
 2005-08-29 19:49
#57506 #57506
User since
2004-02-19
1750 Artikel
BenutzerIn

user image
was haltet ihr von folgendem?
Code: (dl )
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
use strict;
use warnings;

package Foo;

sub new {
my $class = shift;
my $self = { testarray => [] };
bless $self, $class;
return $self;
}

sub testfunc {
my $self = shift;
my $var = shift;

push( @{$self->{testarray}}, $var );
return 1;
}

sub list {
my $self = shift;
return @{$self->{testarray}};
}

package main;

my $foo = new Foo;

$foo->testfunc("a");
$foo->testfunc("b");
print $foo->list, "\n";


ich würde die anschaffung von "Einführung in Perl-Objekte, Referenzen & Module" dringend anraten
$_=unpack"B*",~pack"H*",$_ and y&1|0& |#&&print"$_\n"for@.=qw BFA2F7C39139F45F78
0A28104594444504400 0A2F107D54447DE7800 0A2110453444450500 73CF1045138445F4800 0
F3EF2044E3D17DE 8A08A0451412411 F3CF207DF41C79E 820A20451412414 83E93C4513D17D2B

View full thread Array als Objektvariable