Hi all

I have a log analysis script to which I'm trying to add a pattern
matching option. The script is controlled via the contents of an
inifile, for example ... 

[exception]
title=ERROR: exceptions
extract=0000C000 .* EXCEPTION 
regex=^.*? (..:..:..) .*? \((.*?)\) .*
match=$1 $2

... which the script reads into a hash. The regex in 'extract' is
used to select lines from the logfile into an array. Simulating
all that to shorten the code ...

| use strict;
| use warnings;
| 
| my %ini;
| $ini{section}{regex} = '^.*? (..:..:..) .*? \((.*?)\) .*';
| $ini{section}{match} = '$1 $2';
| my $line = '0000C000 00000000 18/02/2006 07:44:09 EXCEPTION (Scripting: 
Language  not installed) @ Script Execution [0068DFCD] Recursive call (3 
times):';
| 
| $line =~ /$ini{section}{regex}/;
| print "$1 $2";

... produces the required output but my script needs something
like the following as its last line ...

| print $ini{section}{match};

... however that just prints "$1 $2" as a literal string.

I know that I can capture all the matches into an array ... 

| (my @array) = $line =~ /$ini{section}{regex}/;
| print "$_" foreach @array;

... but that elides the space between $1 and $2 in the original
(that space is an example, there could be any literal text
before, between or after the $n's which needs to be included in
the report output).

Is is possible to evaluate the contents of $ini{section}{match}
instead of interpreting it literally? If so, I'd appreciate some
pointers on how to go about it.
-- 

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to