Perl Programming Question:
Download Questions PDF

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

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 Interview Questions And Answers PDF

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?