On Nov 21, 2003, at 3:19 PM, Rajesh Dorairajan wrote:

I've a class (blessed, of course :)) that has variables like:

$self->a = "1";
$self->b = "2";
$self->c = [ '1', '2', '3', '4' ];

I think/hope you meant:


$self->{a} = '1';            # any reason we're quoting integers?
$self->{b} = '2';
$self->{c} = [ qw(1 2 3 4) ];

Now, I want to write a foreach loop to iterate through $self->c and print
the values. However:


foreach my $foo ( $self->c ) {
        print $foo;
}

for my $foo ( @{ $self->{c} } ) { print $foo; }

Hope that helps.

James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to