Home Accessibility Courses Diary The Mouth Forum 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
 
The wonders of Perl

I was asked yesterday (and not for the first time) what my favourite programming language is - and I have to say that it depends on what I'm doing at the time. That's not a "political" answer in any way - as we choose to train only on languages that we're very happy indeed with.

I've just had a little "exercise" to do. I have a list of place names in Mexico, and (on the following line) the dialling code for each of them within the country - for example

Acapulco
74

Cancun
98

Celaya
461

Chihuahua
14

And I needed the data reformatted at one place per line, to include the extra digits for the international code too. Easy - the Perl program was just

while (<>) {
        chop;
        /^\d/ and print "0052$_ $place\n";
        /^[[:alpha:]]/ and $place = $_;
        }

And the output produced:

005274 Acapulco
005298 Cancun
0052461 Celaya
005214 Chihuahua
005216 Ciudad Juarez
005267 Culiacan
00523 Guadalajara
005262 Hermosillo
0052112 La Paz
0052113 Loreto
0052678 Mazatlan
005299 Merida
005265 Mexicali
00525 Mexico City
00528 Monterrey
005222 Puebla
0052322 Puerto Vallarta
005248 San Luis Potosi
005212 Tampico
005266 Tijuana
005217 Torreon
005229 Veracruz
0052492 Zacatecas Mexico Telmex

We're also often asked how we maintain so much information on this web site AND run courses every week (Tcl last week, Python next ...) and the answer is easy - by using Modern open source languages to provide us with helpful tools to do the job. I've used Perl for this page, and an hour or so ago I was adding data under a PHP page


See also Topicalization in Perl - ideal for short data munging scripts

Please note that articles in this section of our web site were current and correct to the best of our ability when published, but by the nature of our business may go out of date quite quickly. The quoting of a price, contract term or any other information in this area of our website is NOT an offer to supply now on those terms - please check back via our main web site

Related Material

Perl - Topicalization and Special Variables
  [4700] Obfurscated code - it might work, but is it maintainable? - (2016-07-02)
  [4682] One line scripts - Awk, Perl and Ruby - (2016-05-20)
  [4395] Preparing data through a little bit of Perl - (2015-01-15)
  [4301] Perl - still a very effective language indeed for extracting and reporting - (2014-09-20)
  [3449] Apache Internal Dummy Connection - what is it and what should I do with it? - (2011-09-19)
  [2972] Some more advanced Perl examples from a recent course - (2010-09-27)
  [2876] Different perl examples - some corners I rarely explore - (2010-07-18)
  [2833] Fresh Perl Teaching Examples - part 2 of 3 - (2010-06-27)
  [1922] Flurinci knows Raby Lae PHP and Jeve - (2008-12-04)
  [1860] Seven new intermediate Perl examples - (2008-10-30)
  [1829] Dont bother to write a Perl program - (2008-10-10)
  [1728] A short Perl example - (2008-07-30)
  [1705] Environment variables in Perl / use Env - (2008-07-11)
  [1704] Finding operating system settings in Perl - (2008-07-10)
  [1508] How not to write Perl? - (2008-01-15)
  [1444] Using English can slow you right down! - (2007-11-25)
  [1289] Pure Perl - (2007-08-03)
  [1232] Bathtub example - (2007-06-14)
  [1221] Bathtubs and pecking birds - (2007-06-07)
  [1136] Buffering output - why it is done and issues raised in Tcl, Perl, Python and PHP - (2007-04-06)
  [969] Perl - $_ and @_ - (2006-12-07)
  [639] Progress bars and other dynamic reports - (2006-03-09)
  [493] Running a Perl script within a PHP page - (2005-11-12)

resource index - Perl
Solutions centre home page

You'll find shorter technical items at The Horse's Mouth and delegate's questions answered at the Opentalk forum.

At Well House Consultants, we provide training courses on subjects such as Ruby, Lua, Perl, Python, Linux, C, C++, Tcl/Tk, Tomcat, PHP and MySQL. We're asked (and answer) many questions, and answers to those which are of general interest are published in this area of our site.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2019: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01225 708225 • FAX: 01225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/solutions/perl-the ... -perl.html • PAGE BUILT: Wed Mar 28 07:47:11 2012 • BUILD SYSTEM: wizard