Whatever is the problem with print("\e[4;" . ($a += 10) . "HEnd Here $a\n"); ?
Indeed, and whatever would be the problem with
$a += 10;
print("\e[4;${a}HEnd Here $a\n");
I have to say that, while it will work (and other, similar solutions could be found), BrowserUk's solution falls into the category of Stupid Interpolation Tricks in the context of the problem of the OP. I hope westrock2000's original question was prompted by pure curiosity and not by any inclination to actual use, for if westrock2000 tries to use this or a similar trick in production code, he or she had better be sure none of the maintainers of said code know where he or she lives!
| [reply] [d/l] [select] |
BrowserUk's solution falls into the category of Stupid Interpolation Tricks in the context of the problem of the OP.
Your opinion noted and dismissed as irrelevant.
Personally, I'd do it this way: printf ("\033[4;%dHEnd Here $a\n", $a+=10 );, but that doesn't answer the OPs question.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] |
Personally, I'd do it this way: printf ("\033[4;%dHEnd Here $a\n", $a+=10 );, but that doesn't answer the OPs question.
Actually this helped tremendously! One of the side thoughts I had was how to increment the cursor placement from the reference just for that line without modifying the actual reference. The printf solution works perfect!
\033[4;%dHEnd Here $a\n", $a+10 );
### $a remains the same value, but this line is indented 10 spaces usi
+ng $a as reference
| [reply] [d/l] |
Wait, there's also print "\e[4;${a}H\e[10CEnd here\n"; provided you don't need the value of $a later. (I assume you don't, and the OP only increments it in place only because that way he can interpolate simply $a.)
| [reply] [d/l] [select] |