Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: Is there a module for object-oriented substring handling/substitution?

by roboticus (Chancellor)
on Jan 26, 2013 at 17:25 UTC ( #1015517=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1015517]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2016-09-25 18:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (470 votes). Check out past polls.