For 2023 - we are now fully retired from IT training. We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.
Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!
I am also active in many other area and still look after a lot of web sites - you can find an index ((here)) |
Learning to program in Perl
For the last few days, I've been teaching Learning to Program in Perl. Unlike a conventional course style, for this one I had been asked to assume no prior programming knowledge, and covered first principles such as variables, conditionals, and loops.
Here is one of the examples I wrote during the course ...
# The bit you do at the start
print "Please enter first number ";
$entry = <STDIN>;
$sofar = 0;
$howmany = 0;
# The bit you keep repeating
while ($entry > 0) {
$sofar += $entry;
$howmany++;
print "Please enter next number (0 to end) ";
$entry = ;
}
# The bit you do at the end
print "The total was $sofar in $howmany entries\n";
You'll note how I have divided a straightforward little application into "the bit that's done once, first", "the bit that's repeated", and "the bit that's done at the end. And you'll note too how important the comments are!
Given a couple of days, we moved on from examples like the one above to a program that was reading and analysing a log file ... and coming out with results. Perl is, after all, the Practical Extraction and Reporting Language (written 2008-04-11, updated 2008-04-12)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles Q904 - Object Orientation and General technical topics - Analysing a Programming Task [747] The Fag Packet Design Methodology - (2006-06-06) [1345] Perl and Shell coding standards / costs of an IT project - (2007-09-11) [1513] Perl, PHP or Python? No - Perl AND PHP AND Python! - (2008-01-20) [1850] Daisy the Cow and a Pint of Ginger Beer - (2008-10-21) [1853] Well structured coding in Perl - (2008-10-24) [2327] Planning! - (2009-08-08) [2715] Uploading an image, document or pdf via a browser (php) - (2010-04-10) [2834] Teaching examples in Perl - third and final part - (2010-06-27) [3329] Perl from basics - (2011-06-20) [3366] Specification, Design, Implementation, Testing and Documentation - stages of a (Java) programming project - (2011-07-21) [3461] From flowchart to program - code design for the newcomer - (2011-09-29) [3895] Flowchart to program - learning to program with Well House - (2012-10-14) P204 - Perl - Conditionals and Loops [353] Wimbledon Neck - (2005-06-20) [930] -> , >= and => in Perl - (2006-11-18) [1191] Smart English Output - via PHP and Perl ? : operator - (2007-05-18) [1468] Lexical v Arithemetic testing, Bash and Perl - (2007-12-11) [1477] Decisions - small ones, or big ones? - (2007-12-18) [1696] Saying NOT in Perl, PHP, Python, Lua ... - (2008-07-04) [1727] Equality and looks like tests - Perl - (2008-07-29) [2351] Ternary operators alternatives - Perl and Lua lazy operators - (2009-08-12) [2550] Do not copy and paste code - there are much better ways - (2009-12-26) [2711] For loop - checked once, or evety time? Ruby v Perl comparison and contrast - (2010-04-07) [2832] Are you learning Perl? Some more examples for you! - (2010-06-27) [3004] Increment operators for counting - Perl, PHP, C and others - (2010-10-18) [3397] Does a for loop evaluate its end condition once, or on every iteration? - (2011-08-18) [4031] Showing what programming errors look like - web site pitfall - (2013-03-06) [4322] Learning to Program - the conditional statement (if) - (2014-11-21) [4323] Learning to program - Loop statements such as while - (2014-11-22)
Some other Articles
Gauging point at entrance to Bristols Floating HarbourPHP course dot co, dot ukChew Valley LakesUnderlining in Perl and Python - the x and * operator in useLearning to program in PerlSheep Shearers, Marathon Runners and Ocean SailorsLearning and understanding scripting programming techniquesM25 / South Mimms Service AreaDo not SHOUT and do not whisperAutomating processes through Expect
|
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).
|
|