On Mon, 2002-04-01 at 17:24, Jonathan E. Paton wrote:
> > 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.
> 
> Get a bigger monitor nmy friend ;-)

I normally keep four gnome-terminals open two at 49 lines and two at 25
lines, but sometimes I just have two at 75 lines each.

> 
> > 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);
> 
> I like consistancy, and prefer:
> 

I hope that you meant these foreachs to be one line (each) and your
email client wrapped it.  If not, then I fear for the sanity of the next
guy to maintain your code even more than I fear for the sanity of the
guy after me <grin />.

> my $col = 0;
> $worksheet1->write(0, $col++, $_)
>     foreach @list;
> 
> Of course, you could use:
> 
> my $col = 0;
> $worksheet1->write(0, $col, $_), $col++
>     for @list;
> 
> or even:
> 
> $worksheet1->write(0, $col, $list[$col])
>     for 0..$#list;
> 
> Personally, I think whenever appropriate
> use the alternative forms here.  This is
> especially true of exceptional conditions,
> e.g:
> 
> die "nicely"
>     unless foo == bar;
> 
> rather than:
> 
> unless (foo == bar) {
>     die "nicely";
> }
> 
> which hides the purpose.  There is room
> in this world for preferences, just don't
> expect mine to be same as yours :)
> 
> Jonathan Paton
> 
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
-- 
Today is Boomtime the 19th day of Discord in the YOLD 3168
Wibble.

Missile Address: 33:48:3.521N  84:23:34.786W


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to