in reply to Re^2: Problem Replacing Previously Found String
in thread Problem Replacing Previously Found String

So what kinds of things go into $FindWhat and how is that different than @Column's hashes? Why don't you try out Text::Template? It already does this stuff and without having to invent your own parser.

If all else fails, you could track what $-[0] and $+[0] are when you copy $1 and later use substr() to write back to $Template at those offsets with your replacement.

I don't buy your argument about not using s/// on the grounds that it appears you're rejecting it on some faulty assumptions. Regardless, here's a s///ge alike without actually using s///.

# Ala my $region_start = $-[0]; my $region_length = $+[0] - $-[0]; my $OriginalLine = $1; ... substr $Template, $region_start, $region_length, $ReplacementString;

Replies are listed 'Best First'.
Re^4: Problem Replacing Previously Found String
by NateTut (Deacon) on Nov 17, 2004 at 16:47 UTC
    Thanks. I'll check out Text::Template, that's a new one for me. Nothing fancy goes into $FindWhat, just plain strings like COLUMN_NAME After my first post I discovered $-[0] and I have implemented a version using that. It's still buggy, but it's better. Doug