Dollar 1 before eval = my $capi = ''; if (@{$ctxt{'capi_devices'}}){ $capi = 'afu_op=grpcapp' . "\n" . 'capp=1' . "\n" . 'afusched=1 1 1 0 0 0 0 0' . "\n" . 'afu_type=1 1 1 0 0 0 0 0' . "\n" . 'icnt=200' . "\n" . 'capi_dev=' . join(' ', @{$ctxt{'capi_devices'}})."\n". 'capi_cards=' . @{$ctxt{'capi_devices'}}; } $capi; INP after substitution = splthid=7 splthjobops=0 2 1 1 4 0 2 6 0 3 8 0 4 0 0 # here i expect the $1 contents after evaluation to come that is $capi should be printed but instead $marega is executed.