http://www.perlmonks.org?node_id=960201


in reply to Re: scalar or sub that can tell me the terminal print offset ?
in thread scalar or sub that can tell me the terminal print offset ?

Thx, but no it won't.
This is how I expect such a scalar (or sub) to work:
1. Say I print a 5 (normal) chars string, than the desired scalar will have a increase in value of 5.
2. when in the beginning of a line it will be zero.
3. after a print of \n or \r, reset to zero.
4. after a print of \t, increase value to the next multiple of 8.
5. after a print of \b, decrease value by 1.
6. after a print of \a, no change in value.
7. modulus: every time it gets over 80 it is reduced by 80 (after 80 chars there's a new line).

Probably some other rules too.
I can figure these out, so I can write it (probably),
but I find it hard to believe this doesn't already exists.