I am using the ASCII Controll Sequences to move the cursor on the screen (my site does not have Term::ANSIScreen installed and so I must make do with what we have).
The way it works is like this.
print ("\033[2;5H");
Which would position the cursor to down 2 rows and over 5 columns from top left.
I can use variables by doing the following
$columns = 5;
print ("\033[2;${columns}H");
But my problem comes from when I want to increment the variable without using an intermediate step.
Such as;
$a = 5;
print ("\033[3;${a}HStart Here $a");
print ("\033[4;${$a+=10}HEnd Here $a\n");
What prints out is
Start Here 4
End Here 14
So Perl is updating $a, but it doesn't seem to be passing it to the Escape Sequence. Since "End" starts against the wall that means it getting no value.
I know I can do
$a+=10;
inbetween the print statements, but I was wondering if I can shorthand it even more.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.