#!/usr/bin/perl -w use strict; my @strings = qw(johnny cash willie nelson); my $pos = 0; for my $i (0..$#strings) { substr($strings[$i],$pos,1) =~ tr/jcwn/cjnw/; } print "@strings\n";