in reply to Need to pull substring between two escape sequences.

Be careful about using something like this:
my @matches = ($string =~ /!#(.*?)#!/g);
That will probably not work the way you want it to on the following:
"123!#45!#678#!90"
You probably wanted 678, but you get 45!#678 instead. Try something like the following:
my @matches = ($string =~ /!#((?:[^#!]|#(?!!))*)#!/g );
See this node for details on this.