in reply to Regexp Substitution Problem!!

I think you're trying to go about this in a weird way, where what you really want is to do successive matches against a string, finding a marker (the A~~~blah~A part) and then the stuff that occurred up to the marker. The whole "match something then erase what you just matched" is kinda strange, as it's much easier to just find what you want, stick it into a separate variable (where you can fold-spindle-and-mutilate as much as you want) without having to mess with the original string itself. Maybe something like this?
#!usr/bin/perl my $sentence = " he PP study VB A~~~language~A NP and CC play VB A~~~game~A NP ."; while ($sentence =~ m/(.*?)A~~~(.*?)~A/sg) { my $before_marker = $1; my $marker = $2; print "Before marker is: $before_marker\n"; print "The marker is: $marker\n\n"; # Do stuff with $before_marker and $marker }
which will produce:
Before marker is: he PP study VB The marker is: language Before marker is: NP and CC play VB The marker is: game
Does this get at what you're trying to do? If not, post some more details as to what you really want, as I suspect everyone's a little confused right now.

Gary Blackburn
Trained Killer