#!/usr/local/bin/perl -s use strict; my ($var) = "This is the line that should be changed."; my (@old) = split(/ /,$var); no strict; if ($z){ @old = map { tr/aeiou/AEIOU/; $_;} @old; #imagine many values here } else { @old = "\nBlah-Blah\n"; } use strict; #imagine more code here print "@old\n";