[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] Tighter/cleaner way to do this? map { grep {} } ?



James Harr wrote:
If you're dealing with large amounts of resultant data, it might be
better not to copy and print, but rather just print in the loop.

$first = 1;
foreach(@a){
	next unless /(gold\w+)/;
	print ", " unless $first;
	$first = 0 if $first;
	print $1;
}

Ya, in my real problem they're small lists and I'm not printing, just needing a stripped subset. :)

Thanks,

j