How do I process/modify each element of an array? Use for/foreach: for (@lines) { s/foo/bar/; # change that word y/XZ/ZX/; # swap those letters }