> 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 ;-)

> 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:

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]

Reply via email to