programming-examples/perl/Statement/Using While loop the output the elements in an array.pl

15 lines
205 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/usr/bin/perl -w
use strict;
my @names = qw(A B C D);
print "processing using a while loop:\n";
my $i = 0;
while ($i <= $#names) {
print " Hello $names[$i]!\n";
$i++;
}