Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^4: Modify a variable within curly braces (ASCII Sequence))

by westrock2000 (Beadle)
on Jun 05, 2010 at 11:25 UTC ( [id://843256]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Modify a variable within curly braces (ASCII Sequence))
in thread Modify a variable within curly braces (ASCII Sequence))

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

Replies are listed 'Best First'.
Re^5: Modify a variable within curly braces (ASCII Sequence))
by BrowserUk (Patriarch) on Jun 05, 2010 at 12:09 UTC

    When I've done this sort of thing in the past, I've used a sub to generate the escape sequences:

    sub at{ sprintf "\e[%d;%dH", $_[0], $_[1] }.

    Then you can use something like print at( $_*2, $_ ), 'here' for 1..50;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://843256]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-24 10:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found