--- Craig Moynes/Markham/IBM <[EMAIL PROTECTED]> wrote:
> [snip . . . ]
> The number of mini-regexp differs depending on the date format line
> the user enters.  So i find out how make keys there are (thus the
> number of mini-regexps) and try to construct a string that will print
> out whatever the mini-regexp matched up with.  But of course it
> doesn't work ;)
> 
> <snip>
> $completeRec = "[Wed Aug  2 16:00:02 2000] [notice] caught SIGTERM,
> shutting down";
>  my $numOfKeys = keys %{$self->{DF_TOKENS}};
> for ( $counter = 1; $counter < $numOfKeys; $counter++)
> {
>      $replaceString.="\$$counter ";
> }

TIP: foreach is more efficient that for(;;), Try this:
  $replaceString.="\$$counter "  for my $counter 1..$numOfKeys;

> my $values = $completeRec;
> 
> $values =~ s/.*$self->{DF_REGEXP}.*/$replaceString/g;

Ok, this looks like you are creating a pattern you want and putting it
in $replaceString,  but that means it's a pattern to use as a
replacement. 

I think what you might rather do instead would be to step through it
and print each piece one at a time. Look at perldoc perlre,
specifically at the /c option.



=====
print "Just another Perl Hacker\n"; # edited for readability =o)
=============================================================
Real friends are those whom, when you inconvenience them, are bothered less by it than 
you are. -- me. =o) 
=============================================================
"There are trivial truths and there are great Truths.
 The opposite of a trival truth is obviously false.
 The opposite of a great Truth is also true."  -- Neils Bohr

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Reply via email to