#!/usr/bin/perl my $string = 'LPNTGVTNNAYMPLLGIIGLVTSFSLLGLXKARRD'; while( $string =~ /([KR])/g ) { print "$1 at ", pos($string), $/; } __END__ K at 31 R at 33 R at 34