Re: Counting (easy!) (YES!!)
I think I figured it out! A FIRST!! for ($i = 1; $i <= 5; $i++){ sleep 1; print "$i\n"; } I prints out like this: 1...2...3...4...5 YES!! Thanks everyone! :-) From: "Trent Rigsbee" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: Counting (easy!) Date: Thu, 13 Nov 2003 01:05:37 + I'm sure this is easy but I'm a newbie. I was doing control statements (for, while,etc.) like this: for ($count = 1; $count <= 5; $count++) { print "$count\n"; } What I wanted to do was to make each number appear in sequence like you see in a countdown (or up, in this case) instead of all on the screen at once. I've tried using sleep but I'm not getting anywhere with it. Any ideas? Also, any methods or ideas on how to approach creating code in general? For example, what's the thought process for trying to do what I want to do? I've tried pseudo code and it's helped some but then I hit the wall and don't how to go further. Thanks! _ Frustrated with dial-up? Get high-speed for as low as $26.95. https://broadband.msn.com (Prices may vary by service area.) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Send a QuickGreet with MSN Messenger http://www.msnmessenger-download.com/tracking/cdp_games -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Counting (easy!) (YES!!)
Wouldn't that print out 1 2 3 4 5 ? -Original Message- From: Trent Rigsbee [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 12, 2003 6:13 PM To: [EMAIL PROTECTED] Subject: Re: Counting (easy!) (YES!!) I think I figured it out! A FIRST!! for ($i = 1; $i <= 5; $i++){ sleep 1; print "$i\n"; } I prints out like this: 1...2...3...4...5 YES!! Thanks everyone! :-) >From: "Trent Rigsbee" <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: Counting (easy!) >Date: Thu, 13 Nov 2003 01:05:37 + > >I'm sure this is easy but I'm a newbie. I was doing control statements >(for, while,etc.) like this: > >for ($count = 1; $count <= 5; $count++) { > print "$count\n"; } > >What I wanted to do was to make each number appear in sequence like you >see in a countdown (or up, in this case) instead of all on the screen at once. >I've tried using sleep but I'm not getting anywhere with it. Any ideas? >Also, any methods or ideas on how to approach creating code in general? >For example, what's the thought process for trying to do what I want to do? >I've tried pseudo code and it's helped some but then I hit the wall and >don't how to go further. Thanks! > >_ >Frustrated with dial-up? Get high-speed for as low as $26.95. >https://broadband.msn.com (Prices may vary by service area.) > > >-- >To unsubscribe, e-mail: [EMAIL PROTECTED] For additional >commands, e-mail: [EMAIL PROTECTED] > _ Send a QuickGreet with MSN Messenger http://www.msnmessenger-download.com/tracking/cdp_games -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Counting (easy!) (YES!!)
Trent Rigsbee <[EMAIL PROTECTED]> wrote: : : I think I figured it out! A FIRST!! : : for ($i = 1; $i <= 5; $i++){ : sleep 1; : print "$i\n"; : } As you move into larger programs and scripts it is a good idea to always use strict and warnings. use strict; use warnings; After adding these to the top of your script you'll need to use 'my' before using most variables for the first time: use strict; use warnings; for ( my $i; $i <= 5; $i++ ) { sleep 1; print "$i\n"; } You can also use the range operator to save some typing: for my $i ( 1 .. 5 ) { sleep 1; print "$i\n"; } HTH, Charles K. Clarkson -- Head Bottle Washer, Clarkson Energy Homes, Inc. Mobile Home Specialists 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]