oh, not at all. I'm quite surprised that after an hour googling I haven't found any ready solution for this problem. Perl has been one of the "big" programming languages for decades and there is no "quick" solution for this simple (for experienced programmer) problem.