sub set_piece_at_pos { my $self=shift; my $pos=shift; my $piece=shift; my @rep=split //,$self->{rep}; $rep[$pos]=$piece; $self->{rep}=join('',@rep); } [download]
In reply to Can you set a character in a string at a given index directly? by tkguifan