- or download this
use strict;
...
# 5. Demonstrate the folly of breaking out of "map" with "last"
@odds = map { ($_ % 2)? $_: last } @nums;
- or download this
foreach (@nums) { ($_ % 2) and push @odds, $_ }
- or download this
Can't "last" outside a loop block at last_test.pl line 27.