my $input = '\one\two\three\four'; my $last = ( split /\\/, $input )[-1]; print $last, "\n";