$served = ($served =~ s/\/$//) if ($served =~ /^\/.+?\/$/); #### if the served page has a trailing "/" { set served equal to a substition of served without the "/" }