in reply to Substituting in the substitution!

I'd probably use duff's solution, but here's another way to do it:

my $str = join "_", split m([ /]), "[ABC AB AB12/83]"; substr($str, 0, 1) = ""; substr($str, -1, 1) = "";

Update: here's a [very ugly] way to do it all in one line:

my $str = substr ${\join "_", split m([ /]), "[ABC AB AB12/83]"}, 1, -1;