Q: In Perl, is there a way to do simple arithmetic inside quotes?
Sometimes I may need to do things like the example below, but Perl doesn't interpret it the way I want, and I can only do it with another variable. Is there a trick?
$i = 5;
print "{$i*10}";
A: I suggest you use
printf:printf("%s", $i * 10);
No comments:
Post a Comment