RE: Counting (easy!)

2003-11-12 Thread Tim Johnson
Try using the "\b" character to erase your output. -Original Message- From: Trent Rigsbee [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 12, 2003 5:06 PM To: [EMAIL PROTECTED] Subject: Counting (easy!) I'm sure this is easy but I'm a newbie. I was doing control statements (for, wh

Re: Counting (easy!)

2003-11-12 Thread david
Trent Rigsbee wrote: > 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 s

Re: Counting (easy!)

2003-11-12 Thread Kevin Old
On Wed, 2003-11-12 at 20:05, Trent Rigsbee wrote: > 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

Re: Counting (easy!)

2003-11-12 Thread drieux
On Wednesday, Nov 12, 2003, at 18:07 US/Pacific, david wrote: [..] like count down from 5 to 1 slowly in a single row? try: [panda]# perl -e '$|=1; print " @{[6-$_]}\r" and sleep(1) for(1..5)' david Minor Nit, that "\r" will not actually go out 54321 rather pleasantly returns the cursor to the

Re: Counting (easy!)

2003-11-12 Thread Tore Aursand
On Thu, 13 Nov 2003 01:05:37 +, Trent Rigsbee wrote: > for ($count = 1; $count <= 5; $count++) { > print "$count\n"; > } This is very C'ish. In Perl we tend to: for ( 1..5 ) { print $_ . "\n"; # sleep( 1 ); } Uncomment the sleep() thing if you want Perl to sleep for 1 se

Re: Counting (easy!)

2003-11-12 Thread John W. Krahn
Trent Rigsbee wrote: > > 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"; > } In Perl that is usually written as: for $count ( 1 .. 5

RE: Counting (easy!)

2003-11-13 Thread Dan Muey
> In Perl that is usually written as: > > for $count ( 1 .. 5 ) { > print "$count\n"; > } Or even easier: for(1..5) { print; } Or if you nee the newline: for(1..5) { print "$_\n"; } HTH DMuey > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTE

Re: Counting (easy!)

2003-11-13 Thread Rob Dixon
Dan Muey wrote: > > > > > In Perl that is usually written as: > > > > for $count ( 1 .. 5 ) { > > print "$count\n"; > > } > > Or even easier: > for(1..5) { print; } > Or if you nee the newline: > for(1..5) { print "$_\n"; } If we're competing, then there's print for 1..5 ;) Rob -- To

RE: Counting (easy!)

2003-11-13 Thread Tore Aursand
On Thu, 13 Nov 2003 09:05:45 -0600, Dan Muey wrote: >> In Perl that is usually written as: >> >> for $count ( 1 .. 5 ) { >> print "$count\n"; >> } > Or even easier: > for(1..5) { print; } Or _even_ easier; print 1..5; Hah! :-) -- Tore Aursand <[EMAIL PROTECTED]> -- To unsubscribe,

Re: Counting (easy!)

2003-11-13 Thread Rob Dixon
Tore Aursand wrote: > > On Thu, 13 Nov 2003 09:05:45 -0600, Dan Muey wrote: > >> In Perl that is usually written as: > >> > >> for $count ( 1 .. 5 ) { > >> print "$count\n"; > >> } > > > Or even easier: > > for(1..5) { print; } > > Or _even_ easier; > > print 1..5; For the subscribers who d

Re: Counting (easy!)

2003-11-13 Thread John W. Krahn
Rob Dixon wrote: > > Tore Aursand wrote: > > > > On Thu, 13 Nov 2003 09:05:45 -0600, Dan Muey wrote: > > >> In Perl that is usually written as: > > >> > > >> for $count ( 1 .. 5 ) { > > >> print "$count\n"; > > >> } > > > > > Or even easier: > > > for(1..5) { print; } > > > > Or _even_ easier;

Re: Counting (easy!)

2003-11-13 Thread Steve Grazzini
On Thu, Nov 13, 2003 at 12:09:24PM -0800, John W. Krahn wrote: > Rob Dixon wrote: > > For the subscribers who don't already know, > > what are the differences between my > > > > print for 1..5 > > for iterates over the list 1..5 and sets $_ with each value and then > print is called for each it

Re: Counting (easy!)

2003-11-13 Thread Rob Dixon
John W. Krahn wrote: > > > > > For the subscribers who don't already know, > > what are the differences between my > > > > print for 1..5 > > for iterates over the list 1..5 and sets $_ with each value and then > print is called for each item and print out the value in $_. > > > and Tore's > > >

Re: Counting (easy!)

2003-11-13 Thread John W. Krahn
Steve Grazzini wrote: > > On Thu, Nov 13, 2003 at 12:09:24PM -0800, John W. Krahn wrote: > > Rob Dixon wrote: > > > For the subscribers who don't already know, > > > what are the differences between my > > > > > > print for 1..5 > > > > for iterates over the list 1..5 and sets $_ with each value

Re: Counting (easy!)

2003-11-13 Thread Rob Dixon
Steve Grazzini wrote: > > On Thu, Nov 13, 2003 at 12:09:24PM -0800, John W. Krahn wrote: > > Rob Dixon wrote: > > > For the subscribers who don't already know, > > > what are the differences between my > > > > > > print for 1..5 > > > > for iterates over the list 1..5 and sets $_ with each value

Re: Counting (easy!)

2003-11-13 Thread Jimstone77
I have a list of email addresses in a text file one to a line. How would I seach for a particular email address? $email = "[EMAIL PROTECTED]"; while { if ($email eq $_) { $OK = 1; } } It seems the @ symbol somehow doesn't work in this search. What would be a better (or right) way t

Re: Counting (easy!)

2003-11-13 Thread Steve Grazzini
On Thu, Nov 13, 2003 at 09:16:59PM -, Rob Dixon wrote: > Steve Grazzini wrote: >> This is a documented optimization w/r/t foreach() loops, but the same >> thing applies to the foreach() modifier. > > What the code is optimised to is a touch OT, but I've never seen this > documented Steve. Can

Re: Counting (easy!)

2003-11-13 Thread Tore Aursand
On Thu, 13 Nov 2003 16:19:32 -0500, Jimstone77 wrote: > I have a list of email addresses in a text file one to a line. How would I > seach for a particular email address? > > $email = "[EMAIL PROTECTED]"; > > while { >if ($email eq $_) { > $OK = 1; >} > } Doesn't this work? I wou

RE: Counting (easy!)

2003-11-13 Thread LoBue, Mark
> -Original Message- > From: Tore Aursand [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 13, 2003 3:50 PM > To: [EMAIL PROTECTED] > Subject: Re: Counting (easy!) > > > On Thu, 13 Nov 2003 16:19:32 -0500, Jimstone77 wrote: > > I have a list of email add

Re: Counting (easy!)

2003-11-14 Thread Tim
You need to escape the '@' in your variable: /*** open(FILE, " $email = "[EMAIL PROTECTED]"; while () { print; print if (/$email/); # $OK = 1 if /$email/; } */ At 04:19 PM 11/13/03 -0500, you wrote: I have a list of email addresses in a text file one to a line.

Re: Counting (easy!)

2003-11-14 Thread R. Joseph Newton
Steve Grazzini wrote: > > What do you think is happening under the hood for something like > > > > print for (0..0, 1, 2..5, func(6)..func(99)) > > I think the whole list would have to be generated. The optimization > only applies to the case where there's just one range in place of the > LIST.

Re: Counting (easy!) (YES!!)

2003-11-12 Thread Trent Rigsbee
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:0

RE: Counting (easy!) (YES!!)

2003-11-12 Thread Tim Johnson
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++){

RE: Counting (easy!) (YES!!)

2003-11-12 Thread Charles K. Clarkson
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

Re: Counting (easy!) - select???

2003-11-13 Thread Christiane Nerz
quite interesting chunk of code - but what the hell does select does here? Yeah - I rtfm - but didn't understand it - maybe one could explain it in more simple words? Jane Kevin Old wrote: What I wanted to do was to make each number appear in sequence like you see in a countdown (or up, in

RE: Counting (easy!) - select???

2003-11-13 Thread Bob Showalter
Christiane Nerz wrote: > Kevin Old wrote: > ... > > select undef, undef, undef, 0.25 or print $_ > > for 1 .. 5; > ... > quite interesting chunk of code - but what the hell does select does > here? Yeah - I rtfm - but didn't understand it - maybe one could > explain it in more simple words? It's

Re: Counting (easy!) - select???

2003-11-13 Thread Rob Dixon
"Bob Showalter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Christiane Nerz wrote: > > Kevin Old wrote: > > ... > > > select undef, undef, undef, 0.25 or print $_ > > > for 1 .. 5; > > ... > > quite interesting chunk of code - but what the hell does select does > > here? Yeah -

Re: Counting (easy!) - select???

2003-11-13 Thread Kevin Old
On Thu, 2003-11-13 at 09:33, Rob Dixon wrote: > "Bob Showalter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Christiane Nerz wrote: > > > Kevin Old wrote: > > > ... > > > > select undef, undef, undef, 0.25 or print $_ > > > > for 1 .. 5; > > > ... > > > quite interesting chunk

Re: Counting (easy!) - select???

2003-11-13 Thread Rob Dixon
Kevin Old wrote: > > On Thu, 2003-11-13 at 09:33, Rob Dixon wrote: > > "Bob Showalter" <[EMAIL PROTECTED]> wrote in message > > > > > > Christiane Nerz wrote: > > > > Kevin Old wrote: > > > > ... > > > > > select undef, undef, undef, 0.25 or print $_ > > > > > for 1 .. 5; > > > > ... > > > > quit

Re: Counting (easy!) - select???

2003-11-15 Thread R. Joseph Newton
Rob Dixon wrote: > > Not exactly a transparent piece of code though is it. Especially > if your base system isn't Unix! Works jusat fine on Windows, although it helps to have a longer list, since this gets p[rocessed really fast, too fast to see what's going on. Try increasing the loop count to

Re: Counting (easy!) - select???

2003-11-16 Thread Rob Dixon
R. Joseph Newton wrote: > > Rob Dixon wrote: > > > > > Not exactly a transparent piece of code though is it. Especially > > if your base system isn't Unix! > > Works jusat fine on Windows, although it helps to have a longer list, since this > gets p[rocessed really fast, too fast to > see what's g

Re: Counting (easy!) - select???

2003-11-16 Thread Rob Dixon
Joseph wrote: > > Rob Dixon wrote: > > > > Not exactly a transparent piece of code though is it. Especially > > if your base system isn't Unix! > > Works jusat fine on Windows, although it helps to have a longer list, > since this gets p[rocessed really fast, too fast to see what's going > on. Try

search for email address in file, was Re: Counting (easy!)

2003-11-13 Thread Wiggins d Anconia
Please choose a subject that is reflective of your post and start a new thread when appropriate... > > I have a list of email addresses in a text file one to a line. How would I > seach for a particular email address? > > $email = "[EMAIL PROTECTED]"; > The @ in the above does need to be esca