Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Perl Programming guidlines/rules

by Abigail-II (Bishop)
on Nov 21, 2002 at 18:14 UTC ( #214848=note: print w/replies, xml ) Need Help??


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

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

Replies are listed 'Best First'.
Re: Re: Perl Programming guidlines/rules
by BUU (Prior) on Nov 21, 2002 at 23:48 UTC
    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

        No, it doesn't localize, and I'm fairly certain that BUU was pointing out that failing to do so is dangerous.

        Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://214848]
help
Chatterbox?
[1nickt]: I had an interview couople of weeks ago, heard from a principal engineer that a friend of his who works at The Google told him that the self-teaching software that determines the dynamic pricing for their adverts...
[1nickt]: ... has become so complex that there is no one at the Goole who knows what it does.
[marto]: William Gibson was right
[moritz]: a classical problem with machine learning
[1nickt]: moritz isn;t the difference today that the machine learning algos are in charge of most stuffs?
[moritz]: depends on what you mean by "most stuff"
[1nickt]: I am sure I don't know about most of the stuff that is no longer controlled by humans. I do know that it's past the point of determining consumer pricing and into things that can kill me with blunt force!
[holli]: but is this really a problem 1nickt? Nobody knows how your human taxi drivers brain works either

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2017-11-21 13:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (301 votes). Check out past polls.

    Notices?