my $input = 'rnbqkbnr'; my @results; push @results, $-[0] while $input =~ /(n)/g; print "@results"; #### push @results, $-[0] while $input =~ /n/g;