DEVFYI - Developer Resource - FYI

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

Perl Questions and Answers


(Continued from previous question...)

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

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

(Continued on next question...)

Other Interview Questions