#!/usr/bin/perl -w my $state = "mississippi"; while ($state =~ /.i/g) { print pos($state),":",$&,$/; } __END__ 2:mi 5:si 8:si 11:pi