Usually, what I prefer to do is to set up a regular-expression, which extracts the "useful" parts of the information while also being sure that the input actually does conform to the expected syntax.
Perl provides a full complement of "printf/scanf"-type formatting routines, and it's also pretty darned smart when it's "type-casting" information to-and-from a string. This is to be expected, since Perl is really a power-tool for manipulating strings.
As you explore your project, look first at CPAN.
Open your mind to any possibility that you can find. No matter what you are setting out to do, CPAN has probably already done it. You will either find complete applications or modules that will give you a huge