Try
$cmd1 = 'This';
$cmd2 = 'Is';
$cmd3 = 'a';
$cmd4 = 'test';
my @cmds = map{eval '$cmd'.$_} (1..4);
There are also ways to do one eval of '($cmd1, $cmd2, $cmd3, $cmd4)', but I can't think of a way that does not require using a temporary variable like this:
my $t='(';
$t.= "\$cmd$_, " for (1..4);
@cmds = eval $t.')';
Update Just realised from reading Mr Muskrat's post below that you can interpolate and then use that to get another variable. Hence this may be your best version
$cmd1 = 'This';
$cmd2 = 'Is';
$cmd3 = 'a';
$cmd4 = 'test';
my @cmds = map{ ${"cmd$_"} }(1..4);
Dingus
Enter any 47-digit prime number to continue.