On my way to Perl wisdom I am stuck with a (probably simple) problem:
I try to replace all characters from the beginning and end of a string with another character but not within the string. Here is an example:
$string = "---------xxxxxxxxxxxxxxx------yyyyyyyyyyyyyy--------";
$string =~ s/\A-+|-+$/?/g;
The output is:
However what I want is to replace ever - with an ?. What am i doing wrong here?
I searched on the web but found no solution. Is this even possible with regular expressions?
Thank you in advance!