< Perl Programming
PROGRAM FOR COUNTING THE NO: OF ENTRIES AND THE TOTAL
#!/usr/bin/perl
$total = 0;
$count = 0;
do {
print ("Enter a number 0 to quit : ");
$value = <>;
chomp ($value);
$total = $total + $value;
if ($value != 0) {$count++;}
} while ($value != 0);
print ("\nNumber of entries : $count");
print ("\nTotal : $total\n");
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.