Perl/Shell Knowledge Sharing
Perl Interview Questions and Answers
Saturday, July 9, 2011
In Perl,is there a way to do simple arithmetic inside quotes?
$i = 5;
print "{$i*10}";
Sometimes I may need to do things like above,but Perl doesn't
interpret it the way I want,and I can only do it with another
variable.Is there a trick?
I suggest you use "printf":
printf("%s",$i*10);
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment