No offense taken (TMTOWTDI). For debugging purposes I like to be able to see entire functions (and sometimes more than one) on the screen at the same time. With short loops like this one that means keeping it as short and sweet as possible to maximize the amount of code visible at one time. So I tend to convert code that looks like this:
my $col = 0; foreach my $data (@list) { $worksheet1->write(0, $col, $list); $col++; } to my $col = 0; $worksheet1->write(0, $col++, $_) foreach (@list); Sometimes I will even shorten the foreach to a for if I am running out of room. I am using Perl 5.6.1. On Mon, 2002-04-01 at 16:19, Nikola Janceski wrote: > Chas, no personal offense, but that code just looks ugly. I like the way > it's originally written by Mike. > > So what version of perl are you using? perl -v > > > -----Original Message----- > > From: Chas Owens [mailto:[EMAIL PROTECTED]] > > Sent: Monday, April 01, 2002 4:09 PM > > To: Michael Stearman > > Cc: [EMAIL PROTECTED] > > Subject: Re: Increment a Variable > > > > > > On Mon, 2002-04-01 at 16:03, Michael Stearman wrote: > > > It could be my code. I am using the variable to write to > > an Excel file in > > > which I want to increment the cell from A1 to B1 to C1, etc. > > > > > > $x="A"; > > > foreach $list(@list) { > > > $cell="$x1"; > > > $worksheet1->write($cell, $list); > > > $x++; > > > } > > > > > > > How about using > > > > my $col = 0; > > $worksheet1->write(0, $col++, $_) for (@list); > > > > > > > > -- > > Today is Sweetmorn the 18th day of Discord in the YOLD 3168 > > > > > > Missile Address: 33:48:3.521N 84:23:34.786W > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > ---------------------------------------------------------------------------- > -------------------- > The views and opinions expressed in this email message are the sender's > own, and do not necessarily represent the views and opinions of Summit > Systems Inc. -- Today is Sweetmorn the 18th day of Discord in the YOLD 3168 Fnord. Missile Address: 33:48:3.521N 84:23:34.786W -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]