Can Perl string interpolation perform any expression evaluation?

There’s a similar shorthand in Perl for this:

$a = 1;
print "@{[$a + 1]}"

This works because the [] creates a reference to an array containing one element (the result of the calculation), and then the @{} dereferences the array, which inside string interpolation prints each element of the array in sequence. Since there is only one, it just prints the one element.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)