in reply to text file validation

Which part are you having trouble with?

Some useful tips: open to open a file, <...> to read from a file, length to get the length of a string, substr to get a substring.

And your question appears to have nothing at all to do with validation.

--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg