[Koha-devel] koha code cleaning bug?

Sébastien Nadeau Sebastien.Nadeau at bibl.ulaval.ca
Mon Sep 29 20:32:04 CEST 2008


Joe Atzberger wrote:

> Case in point though, here I agree it is better to add
> a variable rather than assign to $_.  But more broadly,
> coding to avoid $_ altogether is working against the
> language unnecessarily and, imho, unproductively.

Said this way, it looks like it's a hard thing to figure out how to avoid using $_. But it's not. It's even the opposite: often it's harder figuring out how to use it. We're not forced of using $_ just because we can do it. In nested constructs, unless you explicitly scope it using my $_, the brain will always need more efforts to determine on which $_ we are working. It is definatly simpler to use iterators in this case. It does not go against the language, iterator variables are perfectly supported and encouraged. Even in simple loops, it's nothing of a challenge and on the long run will prove to be productive in more complex code.

Sébastien



More information about the Koha-devel mailing list