Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - 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))
Converting to Perl - the sort of programs you will write

I've put many of the examples that I wrote during last week's Perl Course into our converting to Perl resource, and they've available for use and download from there, subject to the usual "use at your own risk" exclusion!

Where delegates are used to prescriptive, declared languages such as Cobol (or being more modern, Java!), the Perl ethoses of 'Perl assumes you know what you are doing" and 'you don't need to tell Perl - it can work it out' and 'if you leave out a variable name, it may assume $_' can cause a considerable degree of consternation and be quite hard to accept - after all, they have always been taught to remain in their seat until the aircraft comes to a complete halt, and the idea of getting up at 2500 feet and jumping out is alien to them, however safe the parachute of Perl might be, and however much quicker they'll get home by jumping out and landing in their own back garden rather than carrying on to some London airport from where they have to get land transport back home.

There's a wide variety of examples in that directory, then ... let me give you some tasters and you can then explore further ...

[link] to documentation and documentation comment example. With such a freeflow language as Perl, it's vital for you to comment it well and also provide user documentation.

[link] to an example that uses list processing; in Perl, there are many occasions where you don't need to write code to process every elememt of a list - built in functions do the looping for you resulting in shorter and faster running code

[link] to a context example. Languages like English use 'context' to add sense to works. If I write "Reading is a ...", you won't know if I'm referring to the town or the skill until I add the next work ... "Thames side" will tell you it's a town and "useful" will imply that it's probably the skill. Perl supports context too - you'll see different behaviours is some thing's used as a scalar, as a list, as a string within double quotes, or as an integer.

[link] to a 'live' web log file analysis example. This example uses many of the fundamental Perl elements (list, hashes, regular expressions and more) for the rapidly written analysis of a file. As an example during the course, I analysed my 35 Mbyte log file from the previous day, and this example is the code I wrote. You'll see how many hits we had to each page, and a sorted table showing what proportion of our traffic was for each of the pages, sorted by page traffic levels.


Illustration - In Perl, you use the < and > pair to say "read from" a file handle; there are 4 file handles always open and available - for reading you have ~STDIN and DATA (STDOUT and STDERR are for output) and you simply read from them an assign into a variable. No need to open, no need to declare the variable they're going on to as it will be automatically created ....
(written 2009-03-08)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
P704 - Managing Perl Projects
  [836] Build on what you already have with OO - (2006-08-17)
  [1395] Dont just convert to Perl - re-engineer! - (2007-10-18)
  [2375] Designing your data structures for a robust Perl application - (2009-08-25)

P201 - Perl - Introduction
  [25] Release numbers - (2004-08-23)
  [317] Programming languages - a comparison - (2005-05-20)
  [382] Central London Courses - Perl, PHP, Python, Tcl, MySQL - (2005-07-18)
  [577] Learning to program in Perl or PHP - (2006-01-26)
  [594] Twice is a co-incidence and three times is a pattern - (2006-02-07)
  [604] Perl - multiprocess applications - (2006-02-13)
  [629] Choosing the right language - (2006-03-01)
  [691] Testing you Perl / PHP / MySQL / Tcl knowledge - (2006-04-19)
  [743] How to debug a Perl program - (2006-06-04)
  [846] Is Perl being replaced by PHP and Python? - (2006-08-27)
  [924] The LAMP Cookbook - Linux, Apache, MySQL, PHP / Perl - (2006-11-13)
  [1717] Q - Should I use Perl or Python? - (2008-07-23)
  [1753] Perl v PHP, choosing the right language - (2008-08-14)
  [1852] Perl and Blackberries - (2008-10-23)
  [2812] What is Perl? - (2010-06-15)
  [2832] Are you learning Perl? Some more examples for you! - (2010-06-27)


Back to
Efficient calls to subs in Perl - avoid duplication, gain speed
Previous and next
or
Horse's mouth home
Forward to
Setting up a MySQL database from PHP
Some other Articles
Weekday or Weekend PHP, Python and Perl classes?
Extra PHP Examples
Copyright, Portability and other nontechnical web site issues
Setting up a MySQL database from PHP
Converting to Perl - the sort of programs you will write
Efficient calls to subs in Perl - avoid duplication, gain speed
Playing Catchup
Perl - lists do so much more than arrays
Melksham Industrial
Static mirroring through HTTrack, wget and others
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., 2024: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/2070_Con ... write.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb