in reply to intron length
A .GTF file? Well, a tiny bit of Googling sent me to this page at this very interesting-looking site: http://www.bioperl.org/wiki/GTF.
In fact, the first page of my Google search pointed to an abundance of pages, and Perl packages including Bio::FeatureIO::GTF which ... although I am not a biologist ... do strongly suggest to me that the problem you are trying to solve is one that has been thoroughly solved before. That is usually the case with Perl.