my @cmds = ($cmd1, $cmd2, $cmd3, $cmd4); #### # Create all at once my @cmds = qw(This Is a test); # -OR- Create one at a time my @cmds; push @cmds, 'This'; push @cmds, 'Is'; push @cmds, 'a'; push @cmds, 'test'; # Then use the array of cmds for (@cmds) { print "$_\n"; }