in reply to removing the last word

If you just want to remove the last "word" then:

my $full = '/usr/local/jboss'; my ($path, $tail) = $full =~ m|^(.*/)(.*?)$|; print "Path: $path\n"; print "Tail : $tail";

Perl is Huffman encoded by design.