| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Book, `programming in perl` |
Hi All.
subj.
publisher "Next Handbooks" (Australia) , author Jaye Gallagher, no ISBN.
This short book seems to be a good introduction to perl for programmers
however some of the example code seems suspect (and it's also not on the CD)
eg:
Sub SumList {
my ($total, $current) = (0, 0);
while($current = pop);
{
total += $current
};
return $total;
}
print sumlist ( 1, 2, 3, 4, 5);
shouldn't that "while" be
while( defined $current=pop)
That aside I'm starting to see how someone could consider writing FIDO
applications in perl, pack and unpack look real handy...
hmm, lists can contain not only 0 but also undef.
maybe this would be better
Sub SumList {
my $total = 0;
$total += pop while(defined);
return $total
}
or maybe use foreach instead?
I'm starting to like this language.
please let me know if I've made any mistakes.
-=> Bye <=-
---
* Origin: As King Arthur said: Some days it all seems so feudal. (3:640/1042)SEEN-BY: 633/267 270 @PATH: 640/1042 531 954 774/605 123/500 106/2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.