Re: Curly braces and the logic of PERL



On Mon, Oct 27, 2008 at 20:28, Rob Dixon <rob.dixon@xxxxxxx> wrote:
John W. Krahn wrote:

The fewer lines of code to read and/or write, the easier it is to spot
mistakes, the less chance for "action at a distance."

Not at all.

Is this

sub wanted { return unless -f; open my $FH, '<', $_ or die "Cannot open '$_'
$!"; while ( <$FH> ) { /\Q$string/ && print $REPORT "$File::Find::name\n" and
return; } } find \&wanted, '/test';

easier to debug?

No, it is not, but it also isn't fewer lines of code; it is many lines
of code compressed into fewer lines. Fewer lines of code means using
higher level constructs (such as anonymous subroutines) to eliminate
redundant code.


--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.
.



Relevant Pages

  • Re: Curly braces and the logic of PERL
    ... John W. Krahn wrote: ... The fewer lines of code to read and/or write, the easier it is to spot ... mistakes, the less chance for "action at a distance." ...
    (perl.beginners)
  • Re: Howard theory - "cannot be computed"
    ... assembled by chance alone. ... Science isn't about knowing a specific distance. ... evidence for your magical poofer causal explanation and I have already ...
    (talk.origins)
  • Re: Y&R- My New Favorite Couple
    ... with Nina and Chance and Philip entering to remind Nina that *she* was ... Chance is fine as well as NuAdam. ... Chloe rocks. ... and spot on in the Billy Abbott character portrayal! ...
    (rec.arts.tv.soaps.cbs)
  • Re: Curly braces and the logic of PERL
    ... The fewer lines of code to read and/or write, the easier it is to spot ... comes from Perl's origins on the Unix platform, and use of shortcuts like this, ... that are familiar to Unix shell programmers, do nothing to help Perl's migration ... the easier it is to spot mistakes". ...
    (perl.beginners)
  • Re: In the bulls-eye
    ... >> if you're in the wrong spot. ... >> been detected and tracked with that chance of hitting the Earth on ... A 1% chance isn't chilling. ...
    (sci.physics)