http://www.perlmonks.org?node_id=1015517


in reply to Re^2: Is there a module for object-oriented substring handling/substitution?
in thread Is there a module for object-oriented substring handling/substitution?

smis:

Ok, now I understand what you're asking for. I had a slightly different model in mind.

So you're looking for the ability to do something like:

# X is regex stuff to detect start of "interesting region", Y detects +end if ($clob =~ /(.*)(X.*Y)(.*)/) { my ($stuff_before, $stuff_to_edit, $stuff_after) = ($1, $2, $3); $stuff_to_edit =~ s/foo/bar/g; $clob = $stuff_before . $stuff_to_edit . $stuff_after; }

But without all the gymnastics of dismantling and rebuilding the string. I can see where that would be pretty nice since a large $clob would force you to double the storage space and the associated string manipulations.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

  • Comment on Re^3: Is there a module for object-oriented substring handling/substitution?
  • Download Code

Replies are listed 'Best First'.
Re^4: Is there a module for object-oriented substring handling/substitution?
by smls (Friar) on Jan 26, 2013 at 22:44 UTC

    Yes, I think that's a good way to look at it.