#!/usr/bin/perl use strict; use warnings; main(); exit; sub main { # I took this example sequence from uniprot.org # from entry >sp|P02754|LACB_BOVIN Beta-lactoglobulin my $protein = "MKCLLLALALTCGAQALIVTQTMKGLDIQKVAGTWYSLAMAASDISLLDAQSAPLRVYVEELKPTPEGDLEILLQKWENGECAQKKIIAEKTKIPAVFKIDALNENKVLVLDTDYKKYLLFCMENSAEPEQSLACQCLVRTPEVDDEALEKFDKALKALPMHIRLSFNPTQLEEQCHI"; my %results = (); calculate_protein_details( $protein, \%results); while (my ($k,$v) = each %results) { print $k, " => ", $v, "\n"; } } sub calculate_protein_details { my ($protein, $hash_ref) = @_; # copy here the code (except the first line) from # http://www-nmr.cabm.rutgers.edu/bioinformatics/ZebaView/help.html # (not your mangled code...) }