in reply to declare string with addition of two variables

It looks like you're trying to concatenate the results of $y + 2 to the previous string and assign the entire result to $x. If that's the case, you need to use the concatenation operator "." (see perlop) or join, not the comma operator. Your current code assigns "Expected value is" to $x and then sums $y + 2 but does not use the result of the summation. Try one of these:

$x = "Expected value is " . ($y + 2); $x = join( ' ', "Expected value is", $y + 2 );

Update: Note that "." and "+" have equal precedence (see perlop), so the parentheses are needed to ensure that the sum is concatenated to the string, not just the value of $y.