$var = 'about/';
$var =~ s/^(.*)\/?$/index.php?action=$1/;
I want it to match and substitute the trailing slash. But it isn't, I'm getting this result:
index.php?action=about/
What am I doing wrong? I've tried wrapping it in parenthesis (\/)?
and including the question mark in the parenthesis (\/?)
. Not including the preceding forward slash obviously doesn't do me any good. So how can I get it to eat the slash when it's there?