in reply to Substitution Trickery

Do you really need to discern the case that the path in $served starts with a slash and when it does not? If not I would leave just: $served =~ s/\/$//.

Update: Re: Re: Substitution Trickery gives the answer why the test is actually needed.