in reply to help on reg ex

I assume you mean:
$a="export/home/test/great/great";
you can do:
$a =~ s#/great\z##; print $a; # prints "/export/home/test/great"
(that \z means 'the end of the string')
-- Joost downtime n. The period during which a system is error-free and immune from user input.