undef as a Number
- Acts like zero when used as a number
$count = 1;
while ( $count < 5 ) {
$total += $count;
$count++;
}
print "The total: $total\n";
- See perldoc -f while
| CPU: Perl, Fall 2005 | Perl, Week 2: Arrays, Hashes, Control Structures | #21 |
$count = 1;
while ( $count < 5 ) {
$total += $count;
$count++;
}
print "The total: $total\n";
| Copyright © 2005 Ian Langworth |