Perl Programming Question:

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

Tweet Share WhatsApp

Answer:

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

Download Perl Programming PDF Read All 46 Perl Programming Questions
Previous QuestionNext Question
If EXPR is an arbitrary expression, what is the difference between $Foo::{EXPR} and *{"Foo::".EXPR}?How do I replace every <TAB> character in a file with a comma?