#!/usr/bin/perl -w use strict; use List::Util qw(max); use List::Util qw(min); my $input0 = $ARGV[0]; open (DATA,$input0) || die "cannot open input0"; my %gene_hash; while() { chomp; my ($chr, $start, $end, $gene, $ex) = split(/\t/, $_); my $gene_key = $chr.":".$gene; push( @{ $gene_hash{$gene_key} }, $start ); push( @{ $gene_hash{$gene_key} }, $end ); push( @{ $gene_hash{$gene_key} }, $ex ); } foreach my $key (keys %gene_hash) { my ($c, $g) = split(/\:/, $key ); print "$c\t$g\t"; my $Low=min( @ {$gene_hash{$key} } ); my $High=max( @ {$gene_hash{$key} } ); my $High_ex=max( @ {$gene_hash{$key} } ); { print "$Low\t$High\t$High_ex"; } print "\n"; } __DATA__