Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

(wil) Re: Caffeine and its delivery to monks in need

by wil (Priest)
on May 15, 2002 at 13:07 UTC ( #166708=note: print w/ replies, xml ) Need Help??


in reply to Caffeine and its delivery to monks in need

++broquaint

I love this node! This really amused me how much this great community of Perl hackers are determined to make everything possible with Perl.

I had to add to this thread, so here's my attempt:

my $i = $caffeine_level; for ($i = 0; $i < 100; ++$i) { push (@monk_needs,$caffiene); }

- wil


Comment on (wil) Re: Caffeine and its delivery to monks in need
Download Code
Replies are listed 'Best First'.
Re: Re: Caffeine and its delivery to monks in need
by Juerd (Abbot) on May 16, 2002 at 06:57 UTC

    my $i = $caffeine_level; for ($i = 0; $i < 100; ++$i) {

    The first assignment is useless, as $i's value is immediately overwritten. The loop is inefficient, as for simple loops like this, a Perlish loop is faster and easier to write: for (1..100). Yes, I changed it from 0..99 to 1..100, because 1..100 looks better and you're not using the iterator variable anyway.

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://166708]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2015-07-08 08:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (98 votes), past polls