develooper Front page | perl.module-authors | Postings from November 2003

RE: Class::FakeAttributes -- Opinions Wanted

Thread Previous | Thread Next
From:
Orton, Yves
Date:
November 6, 2003 10:42
Subject:
RE: Class::FakeAttributes -- Opinions Wanted
Message ID:
71B318898201D311845C0008C75DAD1C08961379@defra1ex2
>   $ perl -Mstrict -wle 'my $f = { }; my @a = @{ $f->{foo} }'
>   Can't use an undefined value as an ARRAY reference at -e line 1.

Exactly my point. Stick that expression in a for loop however...

D:\>perl -Mstrict -wle "my $f = { }; my @a=map {$_} @{ $f->{foo} }"

D:\>perl -Mstrict -wle "my $f = { }; for (@{ $f->{foo} }) {print}"

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About