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"; [download]