How do I do < fill-in-the-blank > for each element in an array?

Q

How do I do < fill-in-the-blank > for each element in an array?

✍: Guest

A

#!/usr/bin/perl -w
@homeRunHitters = ('McGwire', 'Sosa', 'Maris', 'Ruth');
foreach (@homeRunHitters) {
print "$_ hit a lot of home runs in one year\n";
}

2013-09-16, 2018👍, 0💬