in reply to use the cut function in a script

You could also generalize your solution and look at one of the CPAN XML modules.