my $quick = '\one\two\three\four'; my $endpart = ($quick =~ m/([^\\]*)$/ ) ? $1 : ''; print qq|The end part is $endpart\n|;