# @markers already holds each marker in each array spot #$htmlfile already has the text of my html file my $count = 0; while ($htmlfile =~ m/]+)"?>/gi){ $htmlfile =~ s/$1/$1$markers[$count]/; $count ++; }