Dear tweetiepooh,
thanks a lot for your clear and useful code. Exactly that was what I needed!
Anyway util's code is very similar, but roubi uses the File::Basename modul which I should avoid in this case, cause I must make a very pure and native perl code, without using any modul.