Help for this page

Select Code to Download


  1. or download this
    $cmd1 = 'This';
    $cmd2 = 'Is';
    ...
    $cmd4 = 'test';
    
    my @cmds = map{eval '$cmd'.$_} (1..4);
    
  2. or download this
    my $t='(';
    $t.= "\$cmd$_, " for (1..4);
    @cmds = eval $t.')';
    
  3. or download this
    $cmd1 = 'This';
    $cmd2 = 'Is';
    ...
    $cmd4 = 'test';
    
    my @cmds = map{ ${"cmd$_"} }(1..4);