programming-examples/perl/Statement/While loop counter.pl

20 lines
324 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!c:\perl\bin
print "\n\nHere is the pre-increment example: \n";
$count = 0;
while ($count < 5)
{
print "The value of \$count is " . ++$count . "\n";
}
print "\n\nHere is the post-increment example: \n";
$count = 0;
while ($count < 5)
{
print "The value of \$count is " . $count++ . "\n";
}