On Thu, 10 Oct 2002, Chip Salzenberg wrote:
: According to Luke Palmer:
: > for ( grep { $_{smoker} and $_{age} > 18 } @Subscribers ) {
: > .send($Cigarette_Advertisement)
: > }
:
: Hm, would this work too:
:
: for ( grep { .{smoker} and .{age} > 18 } @Subscribers )
: { .send($ciggie_ad) }
:
: ? I think .{x} reads better than $_{x} , esp. in parallel with the
: method call in the same loop.
Didn't see the original, but if those are attributes, why wouldn't
it just be:
for grep { .smoker and .age > 18 } @Subscribers {
.send($ciggie_ad)
}
'Course, this might be more readable:
for @Subscribers {
.send($ciggie_ad) if .smoker and .age > 18;
}
Most smokers don't know what "grep" means, after all...
Larry