while ( $src =~ m%([^>]+)%g ) { $inf->{$i} = { 'url' => $1, 'res' => $2 }; $s_text = $2; $n_src =~ s%$s_text%[$i $s_text]%; $i++; }