Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
Retiring, March 2020 - sorry, you have missed our final public course.
The Coronavirus situation has lead us to suspend public training - which was on the cards anyway, with no plans to resume

Please ask about private 'maintenance' training for Python, Tcl, Perl, PHP, Lua, etc
Happily continuing private consultancy / programming work
 
Extracting real data from an exported file in PHP or Perl

"Just give me the data". Where there's a requirement to take data from another program into a Perl or PHP script, it's often easier simply to take the data in a format that it's offered / exported from that other program and use code in Perl or PHP to make appropriate use of that data. The alternative of getting the data supplier to do all sorts of manipulation is, frankly, more trouble than it's worth.

Lisa has passed me a data flow - a dump of all the Melksham retail businesses - from the map she's been working on and is being shown at the West Wilts Show today. It's good, it contains what I need, but it's formatted with the map in mind rather than with the data meaning ("how it should look" rather than "what it means"). Now I could ask for it in XML ;-) ... of I could use Perl or PHP and their powerful text handlers. I have chose to do the latter.

Here is the main "what's this line" decision code - in PHP:

if (ereg("^ ",$record)) { # MAIN HEADER
elseif (count($els) == 1) { # SUB HEAD
elseif (count($els) == 2 and ereg("^[1-9]",$els[1])) { # OUT OF TOWN on map
elseif (count($els) == 2) { # OUT OF TOWN LOCATION not on map
elseif (count($els) == 3) { # IN TOWN LOCATION
else { # ERROR


and here is the formatted list of Melksham retailers I have produced from it. The source code is here. The next stage is going to be to produce listings by area ... as I have the data in my PHP code now, that will be easy. And I know that I need to put a good look and feel onto it!

You can download the map from here.
(written 2009-07-25)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
H104 - PHP - Control Statements
  [4323] Learning to program - Loop statements such as while - (2014-11-22)
  [4322] Learning to Program - the conditional statement (if) - (2014-11-21)
  [3914] While, for, foreach or something else to loop. - (2012-11-06)
  [3895] Flowchart to program - learning to program with Well House - (2012-10-14)
  [3397] Does a for loop evaluate its end condition once, or on every iteration? - (2011-08-18)
  [3200] How a for loop works Java, Perl and other languages - (2011-03-12)
  [2912] Predictions for the seagull population - (2010-08-09)
  [1825] Question Mark - Colon operator (Perl and PHP) - (2008-10-08)
  [1696] Saying NOT in Perl, PHP, Python, Lua ... - (2008-07-04)
  [1477] Decisions - small ones, or big ones? - (2007-12-18)
  [1220] for loop - how it works (Perl, PHP, Java, C, etc) - (2007-06-06)
  [1199] Testing for one of a list of values. - (2007-05-22)
  [1191] Smart English Output - via PHP and Perl ? : operator - (2007-05-18)
  [962] Breaking a loop - Ruby and other languages - (2006-12-03)
  [863] Double and Triple equals operator in PHP - (2006-09-12)
  [657] The ternary operator in Python - (2006-03-25)
  [421] Don't repeat code - use loops or functions - (2005-08-21)
  [406] Assignment, equality and identity in PHP - (2005-08-08)
  [353] Wimbledon Neck - (2005-06-20)
  [340] Code and code maintainance efficiency - (2005-06-08)


Back to
Turning potential customers away
Previous and next
or
Horse's mouth home
Forward to
Hot Tap at West Wilts Show
Some other Articles
A new place in pictures
Breakfast in Mexico
Melksham to Mexico for the week
Hot Tap at West Wilts Show
Extracting real data from an exported file in PHP or Perl
Turning potential customers away
See us at the West Wilts Show
Mistaken identity?
What does x on a linux directory mean?
How much space does my directory take - Linux
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., 2020: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/2304_Ext ... -Perl.html • PAGE BUILT: Sat May 27 16:49:10 2017 • BUILD SYSTEM: WomanWithCat