Chris Wagner in <[EMAIL PROTECTED]>:
> At 12:07 AM 3/2/2006 +0000, [email protected] wrote:
> > | print $ini{section}{match};
> >
> >... however that just prints "$1 $2" as a literal string.
>
> I would try print eval $ini{section}{match}.
Sorry, I should have mentioned that I've tried that ...
| 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 eval $ini{section}{match};
... which results in ...
| Scalar found where operator expected at (eval 1) line 1, near "$1 $2"
| (Missing operator before $2?)
| Use of uninitialized value in print at test.pl line 9.
If I change the 'match' to just '$1', perl outputs ...
| 07:44:09
... and, similarly, for just '$2' ...
| Scripting: Language not installed
... which are exactly the required responses. However, when put
together as '$1 $2' they interact with each other in some way
that I don't understand.
--
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs