Thomas, Mark in <[EMAIL PROTECTED]>: > > From: Jim Hill [mailto:[EMAIL PROTECTED] > > Thomas, Mark in <[EMAIL PROTECTED]>: > > > Jim Hill wrote: > > > > > > > | $ini{section}{match} = '$1 $2'; > > > > ... however that just prints "$1 $2" as a literal string. > > > > > > Hint: the above two lines of your post answer your own question. > > Single quotes don't interpret variables. Double quotes do.
Thanks but, afaict, there are no single quotes anywhere in the script I posted although I do understand how it might look that way. Try running this to demonstrate ... # test.pl use strict; use warnings; my %ini; my $inifile = 'test.ini'; make_ini($inifile); read_ini($inifile); # note - unwrap next three lines my $line = '0000C000 00000000 18/02/2006 07:44:09 EXCEPTION (Scripting: Language not installed) @ Script Execution [0068DFCD] Recursive call (3 times):'; $line =~ /$ini{test}{regex}/; print eval $ini{test}{match}; exit; sub make_ini { my $inifile = shift; open INI, ">$inifile" or die "Can't create $inifile: $!"; print INI '[test]'."\n"; print INI 'regex=^.*? (..:..:..) .*? \((.*?)\) .*'."\n"; print INI 'match=$1 $2'."\n"; close INI or die "Can't close $inifile: $!"; } sub read_ini { my $inifile = shift; my $section; open INI, "<$inifile" or die "Can't read $inifile: $!"; while (<INI>) { chomp; next if /^\s*$/; if (/^\[(.*)\]/) { $section = $1; next; } my ($field, $value) = split /=/, $_, 2; $ini{$section}{$field} = $value; } close INI or die "Can't close $inifile: $!"; } When I run that, I get ... | rdns.org : perl test.pl | 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 12. I know I must be doing something wrong but I've no idea what. -- _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs