Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Re: Perl Programming guidlines/rules

by hakkr (Chaplain)
on Nov 21, 2002 at 17:37 UTC ( #214836=note: print w/ replies, xml ) Need Help??


in reply to Re: Perl Programming guidlines/rules
in thread Perl Programming guidelines/rules

yes but you can improve those things there is not much you can do to improve the readability of $_.

For non perl programmers it can be new concept so also increases learning curve of maintaining the code


Comment on Re: Re: Perl Programming guidlines/rules
Re: Perl Programming guidlines/rules
by Abigail-II (Bishop) on Nov 21, 2002 at 18:14 UTC
    Well, I would make coding standards for good programmers, and from a good programmer, I would assume he/she knows the language. Non-perl programmers shouldn't program Perl. And as a manager, or tech-lead, I wouldn't allow non-Perl programmers to touch Perl code.

    Perhaps rule 0 should be: "People who can't program in Perl are not allowed to touch the code".

    $_ is one of the most basic things in Perl. If you have problems with the readability of $_, you shouldn't call yourself a Perl programmer.

    Abigail

      I support using $_, but you should perhaps implement a standard/guideline in the form of 'Localize $_ in all user created subs', as something like the following:
      sub foo{my $blah=shift; $_=substr $blah,0,1; /foo/;}
      Which looks fairly innocuous in the use of $_ to avoid more temporary vars (It's not an extremely good example, but it serves), but then you do something likemap{foo($_->[0]);$_;} which can return wildly different results then you expected, and lead to many.. interesting.. bugs.
        Wow, that really localizes $_ ? To me, it looks more like a straight assignment to $_. I would've expected something like:

        sub foo { local $_ = shift; /foo/; }

        blyman
        :wq

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://214836]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2014-07-10 00:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (197 votes), past polls