It's always a pleasure to run private courses - for when a questions that's a little bit away from the normal comes up, I can take time to provide a full answer and demonstration without fear of loosing delegates from other companies who have no interest. And so it was today - I have two examples, plus an old favourite.
Firstly, my customers told me that they'll be running a number of other programs / commands from within Perl, and wish to use Perl as the "puppeteer" - writing to and reading from those other processes even as they run. Choosing
ping as an example program to run from within Perl, opened a demonstration process on a pipe and then read from that pipe.
See Source code
Then, I was asked about (and got involved) in socket programming. The first example, with it all in a single program, got a little long ... so I refactored into a structured program, which makes it much easier to follow. See both
the main program source code and
the code of the subs that I used
Finally, they say "the old ones are the best", don't they? I so often write a demonstration to show context - how a list referred to in different ways can be output as all the elements jammed together, with the elements spaced out, or as just the
number of elements in the list. Today's demonstration has its source code
here on our site.
(written 2008-12-02, updated 2008-12-03)
Associated topics are indexed under
P208 - Perl - Lists [3939] Lots of ways of doing the same thing in Perl - list iteration - (2012-12-03)
[3906] Taking the lead, not the dog, for a walk. - (2012-10-28)
[3870] Writing more maintainable Perl - naming fields from your data records - (2012-09-25)
[3669] Stepping through a list (or an array) in reverse order - (2012-03-23)
[3548] Dark mornings, dog update, and Python and Lua courses before Christmas - (2011-12-10)
[3400] $ is atomic and % and @ are molecular - Perl - (2011-08-20)
[2996] Copying - duplicating data, or just adding a name? Perl and Python compared - (2010-10-12)
[2833] Fresh Perl Teaching Examples - part 2 of 3 - (2010-06-27)
[2813] Iterating over a Perl list and changing all items - (2010-06-15)
[2484] Finding text and what surrounds it - contextual grep - (2009-10-30)
[2295] The dog is not in trouble - (2009-07-17)
[2226] Revision / Summary of lists - Perl - (2009-06-10)
[2067] Perl - lists do so much more than arrays - (2009-03-05)
[1917] Out of memory during array extend - Perl - (2008-12-02)
[1828] Perl - map to process every member of a list (array) - (2008-10-09)
[1703] Perl ... adding to a list - end, middle, start - (2008-07-09)
[1316] Filtering and altering Perl lists with grep and map - (2007-08-23)
[1304] Last elements in a Perl or Python list - (2007-08-16)
[968] Perl - a list or a hash? - (2006-12-06)
[928] C++ and Perl - why did they do it THAT way? - (2006-11-16)
[773] Breaking bread - (2006-06-22)
[762] Huge data files - what happened earlier? - (2006-06-15)
[622] Queues and barrel rolls in Perl - (2006-02-24)
[560] The fencepost problem - (2006-01-10)
[463] Splitting the difference - (2005-10-13)
[355] Context in Perl - (2005-06-22)
[240] Conventional restraints removed - (2005-03-09)
[230] Course sizes - beware of marketing statistics - (2005-02-27)
[140] Comparison Chart for Perl programmers - list functions - (2004-12-04)
[28] Perl for breakfast - (2004-08-25)
P223 - Perl - Interprocess Communication [3940] Run other processes from within your Perl program - (2012-12-03)
[3412] Handling binary data in Perl is easy! - (2011-08-30)
[3011] What are .pid files? - (2010-10-23)
[3010] Children, zombies, and reaping processes - (2010-10-23)
[2970] Perl - doing several things at the same time - (2010-09-25)
[2694] Multiple processes (forking) in Python - (2010-03-25)
[604] Perl - multiprocess applications - (2006-02-13)
P224 - Perl - Intersystem Communications [2876] Different perl examples - some corners I rarely explore - (2010-07-18)
[2695] TCP v UDP / Client v Server - Python examples - (2010-03-25)
[2402] Automated Browsing in Perl - (2009-09-11)
[1073] Heartbeat script in Perl - (2007-02-09)
55ca
Some other Articles
Flurinci knows Raby Lae PHP and JeveRomeo and JulieProgress Bar Techniques - PerlTransitionPerl Socket Programming ExamplesWhy I remember East GraftonQuietly putting prices upIt must be nearly ChristmasAlastair Darling helps make paperwork and confusion