Hi,
I have an object with a property containing an array, eg;
---------------------------------------
#!/usr/bin/perl
use strict;
my $Obj = main->new;
exit 0;
sub new {
my $class = shift;
bless {
property => ['zero', 'one', 'two', 'three']
}, $class;
}
---------------------------------------
I can reference each element of the property's array via;
print "$Obj->{'property'}[0]'}\n";
I'm not sure how I can loop through each element of the array .. I've tried;
foreach my $value ($Obj->{'property'}) {
print "$value\n";
}
This just results in "ARRAY(0x82aed20)".
Any ideas?
thanks,
Pete
I have an object with a property containing an array, eg;
---------------------------------------
#!/usr/bin/perl
use strict;
my $Obj = main->new;
exit 0;
sub new {
my $class = shift;
bless {
property => ['zero', 'one', 'two', 'three']
}, $class;
}
---------------------------------------
I can reference each element of the property's array via;
print "$Obj->{'property'}[0]'}\n";
I'm not sure how I can loop through each element of the array .. I've tried;
foreach my $value ($Obj->{'property'}) {
print "$value\n";
}
This just results in "ARRAY(0x82aed20)".
Any ideas?
thanks,
Pete