View Single Post
  #110   Report Post  
Posted to uk.d-i-y
Tim Watts[_3_] Tim Watts[_3_] is offline
external usenet poster
 
Posts: 7,434
Default OT - Programming Languages

On 31/01/15 04:22, John Rumm wrote:
On 29/01/2015 11:52, Tim Watts wrote:
On 29/01/15 11:20, Tim Streater wrote:

Too many "special things" like $_ which make reading perl a constant
WTF? experience.


So don't use them.

use English;

and use nicely named variables.

And don't use $_ at all...


Its funny how many languages tend to acquire a range of awkward looking
and non intuitive constructs that crop up all over the place. The only
justification for them often seems to be "because you can". The problem
becomes self replicating because people learn from seeing examples that
contain them and then use them since they are "normal".




With perl, I guess it is handy for in-line commands like:

perl -n -e 'print "Match: $_\n" if m/wibble/' somefile

But I'd never use that shorthand in actual code.

The best thing for perl on a command line is:

perl -p -i -e 's/ReplaceThis/WithThis/g' aFile

in place editing. I never got on with tr,sed etc - I find perl easier.