perl code from the book Mastering perl for bioinformatics