in reply to problem in splitting the line

The last semicolon is between 2105 and 2123. So split stuffs everything after the last semi into $fields[6], namely "2123 0 chr5 75483987 0 82M3I16M * 0 0". You need to do more work to get the number you want from $fields[6]:
use warnings; use strict; while (<DATA>) { my $line = $_; if ( $line =~ /^HWI/ ) { my @fields = split /:/, $line; my ($f6) = $fields[6] =~ /(\S+)/; print $fields[5], " ", $f6; } } print "\n"; =for output 2105 2123 =cut __DATA__ HWI-1KL120:99:C0C9MACXX:6:1101:2105:2123 0 chr5 75483987 0 82M3I16M * +0 0