[Denver-pm] Dispatch Lists?

Robert L. Harris robert.l.harris at gmail.com
Tue Apr 19 13:28:26 PDT 2016


Anyone have a straight forward script using dispatch lists?  I have one (
4500 lines by now ) which effectively does this:


   1. Open input file
   2. while<input> {
   3.     $Line=<INPUT>
   4.     &Sub1("Line") if ( $Line =~ /<regex pattern 1>/ );
   5.     &Sub2("Line") if ( $Line =~ /<regex pattern 2>/ );
   6.     &Sub3("Line") if ( $Line =~ /<regex pattern 3>/ );
   7.     ... about 25 patterns now ...
   8. }

Yeah, it's ugly, it started out as a 30 line data munger about 2.5 years
ago and I'm looking to speed and clean it up.   Each Sub performs various
actions based which can't be simplified or condensed more than they have.

   I've created my DispatchHash for subs/patterns but I think I'm confusing
myself on actually doing the match and dispatch including passing $Line to
the sub.

Any examples would be very welcome.

Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/denver-pm/attachments/20160419/c1ae4dd7/attachment.html>


More information about the Denver-pm mailing list