Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
Python and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Lua, etc
 
Perl - making best use of the flexibility, but also using good coding standards

Sometimes, examples written during a course are throw-aways ... but at other times they become a useful addition to our resources. On a private private Perl course that I was running yesterday, and continues today and Monday, I found myself writing a useful piece that shows examples of lots of ways of doing virtually the same thing in Perl - and remember the Perl manta - "There's more than one way of doing it" is the headline at the top of "Perl Programming" - the book that's also known as "the camel book" and "The Perl bible".

What does the new example (which you can show [here] in a separate frame) cover?

1. 2 different ways of removing the new line from the end of input
2. 6 different ways of formatting a string for output
3. 12 different ways of writing a condtional (optional) statement
4. 8 different ways of writing code that repeats in a loop

In some ways, variety is good. In other ways ... there are just too many ways of doing things; if code is written by someone who "delights" in using many of them, the people who maintain the code may be given a somewhat tougher task. So I'm a strong advocate of teaching delegates to be aware of the options for when they come to maintain code, but to be selective in what they use when it comes to writing new code.

Within different environments and organisations, stanadards (be they formal or infoaml) should be set for Perl coding to ensure that it can be maintained. But there are some things that date back to the early days of Perl such as goto and redo for loops which should really not be written into new code within any standard.

Next public Perl course ... starts 19th September. There's another one from 5th December, and dates for next year will be on the website by the end of this month. There's also an advanced Perl course in November ...
(written 2011-08-19)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
P202 - Perl Fundamentals
  [4324] Learning to program - variables and constants - (2014-11-22)
  [3917] BODMAS - the order a computer evaluates arithmetic expressions - (2012-11-09)
  [3574] Perl functions such as chop change their input parameters - (2012-01-10)
  [3542] What order are operations performed in, in a Perl expression? - (2011-12-07)
  [3329] Perl from basics - (2011-06-20)
  [3278] Do I need to initialise variables - programming in C, C++, Perl, PHP, Python, Ruby or Java. - (2011-05-05)
  [3102] AND and OR operators - what is the difference between logical and bitwise varieties? - (2010-12-24)
  [3059] Object Orientation in an hour and other Perl Lectures - (2010-11-18)
  [2876] Different perl examples - some corners I rarely explore - (2010-07-18)
  [2832] Are you learning Perl? Some more examples for you! - (2010-06-27)
  [2442] Variable storage - Perl, Tcl and Python compared - (2009-10-08)
  [1946] Variable Types in Perl - (2008-12-15)
  [1826] Perl - Subs, Chop v Chomp, => v , - (2008-10-08)
  [1726] Hot Courses - Perl - (2008-07-28)
  [1448] Question on division (Java) - Also Perl, PHP, Python ... - (2007-11-28)
  [1312] Some one line Perl tips and techniques - (2007-08-21)
  [748] Getting rid of variables after you have finished with them - (2006-06-06)
  [184] MTBF of coffee machines - (2005-01-20)

P206 - Perl - More Loops and Conditionals
  [3914] While, for, foreach or something else to loop. - (2012-11-06)
  [3619] Ruby v Perl - a comparison example - (2012-02-21)
  [3200] How a for loop works Java, Perl and other languages - (2011-03-12)
  [2972] Some more advanced Perl examples from a recent course - (2010-09-27)
  [2967] Multiway branches in Perl - the given and when syntax - (2010-09-22)
  [2892] Alternative loops and conditionals in Ruby and Perl - (2010-07-28)
  [2824] A pint of Black Rat, and a lazy barman - (2010-06-25)
  [2817] Setting a safety net or fallback value in Perl - (2010-06-19)
  [2815] switch and case, or given and when in Perl - (2010-06-17)
  [2711] For loop - checked once, or evety time? Ruby v Perl comparison and contrast - (2010-04-07)
  [1825] Question Mark - Colon operator (Perl and PHP) - (2008-10-08)
  [1696] Saying NOT in Perl, PHP, Python, Lua ... - (2008-07-04)
  [1582] Ruby, C, Java and more - getting out of loops - (2008-03-19)
  [1220] for loop - how it works (Perl, PHP, Java, C, etc) - (2007-06-06)
  [1191] Smart English Output - via PHP and Perl ? : operator - (2007-05-18)
  [962] Breaking a loop - Ruby and other languages - (2006-12-03)
  [657] The ternary operator in Python - (2006-03-25)
  [299] What - no switch or case statement? - (2005-05-03)
  [138] Perl - redo and last without a loop - (2004-12-02)

P711 - An Introduction to Standards in Perl
  [4326] Learning to program - comments, documentation and test code - (2014-11-22)
  [2875] A long day in Melksham ... - (2010-07-17)
  [2688] Security considerations in programming - what do we teach? - (2010-03-22)
  [2375] Designing your data structures for a robust Perl application - (2009-08-25)
  [1863] About dieing and exiting in Perl - (2008-11-01)
  [1853] Well structured coding in Perl - (2008-10-24)
  [1728] A short Perl example - (2008-07-30)
  [1555] Advanced Python, Perl, PHP and Tcl training courses / classes - (2008-02-25)
  [1395] Dont just convert to Perl - re-engineer! - (2007-10-18)
  [1345] Perl and Shell coding standards / costs of an IT project - (2007-09-11)
  [1221] Bathtubs and pecking birds - (2007-06-07)
  [1047] Maintainable code - some positive advice - (2007-01-21)
  [965] KISS - one action per statement please - Perl - (2006-12-05)
  [945] Code quality counts - (2006-11-26)
  [743] How to debug a Perl program - (2006-06-04)
  [668] Python - block insets help with documentation - (2006-04-04)
  [242] Satisfaction of training - (2005-03-11)


Back to
Does a for loop evaluate its end condition once, or on every iteration?
Previous and next
or
Horse's mouth home
Forward to
From fish, loaves and apples to money, plastic cards and BACS (Perl references explained)
Some other Articles
That spec is a kingfisher ...
Open Source Training Schedule - learn a programming language - in Autumn 2011 or 2012
$ is atomic and % and @ are molecular - Perl
From fish, loaves and apples to money, plastic cards and BACS (Perl references explained)
Perl - making best use of the flexibility, but also using good coding standards
Does a for loop evaluate its end condition once, or on every iteration?
Tables as Objects in Lua - a gentle introduction to data driven programming
Parallel but not really parallel. Moving game characters. Coroutines in Lua.
The difference between lists and strings - Tcl
Rodwell Trail, Weymouth
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2019: 404 The Spa • Melksham, Wiltshire • United Kingdom • SN12 6QL
PH: 01225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/3398_Per ... dards.html • PAGE BUILT: Sat May 27 16:49:10 2017 • BUILD SYSTEM: WomanWithCat