my $foo = "\\one\\two\\three\\four" ; my $bar = substr($foo, rindex($foo, "\\") +1) ;