good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Re: Re: Re: C vs. Perlby BrowserUk (Patriarch) |
on Oct 22, 2003 at 22:28 UTC ( [id://301406]=note: print w/replies, xml ) | Need Help?? |
Okay. Here's a somewhat complete though simplistic implementation of the program written in C. It is more complete, in that it includes the code for prompting the user and retrieving the input, and makes some attempt at error checking (not enough), that was completely absent from the perl version above. It also cheats by using a linear search rather than hashing the lookup.
This is about as simple as it is possible to do write something roughly equivalent in C, whereas I've no doubt that this coudl be done as a perl one-liner with a little effort. Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham"Think for yourself!" - Abigail Hooray!
In Section
Seekers of Perl Wisdom
|
|