Re: text on the screen



In article <ScqdncFmgpsgWWjfRVn-vA@xxxxxxxxxx>, dave
<dave@xxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi all,
>
> New to Perl. I saw a perl program (not source code) output formatted text on
> the terminal in the way,
>
> # first time, output a line
> 23 11 1234
>
> # then, update 11 of above line with 22 at same place on screen
> 23 22 1234
>
> so, there is no position change for above two lines, but the contents
> updated. How to do this in Perl?

The simple way is to begin your output lines with "\r", do not end them
with the normal "\n", and write out the entire line each time. You
might add a few spaces at the end to move the cursor over and erase any
characters left over from an earlier, longer line. You should also turn
off output buffering with "$| = 1;".

For more complex schemes, use Curses as Jürgen suggested.

FYI: this newsgroup is defunct. Try comp.lang.perl.misc in the future.


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
.



Relevant Pages

  • Re: How can I perform search & proximity-replace over multiple lines in C source
    ... I have so many of these edits to make over so many source code ... a simple Perl program involving pattern matching will do. ... If you want to get fancy, you could output the info about manual fixes ...
    (comp.lang.perl.misc)
  • Re: Executing commands through Perl
    ... Its my first time using Perl and I would like some help in performing some relatively simple operations. ... You have to munge it before output. ... I want to know how to call a command line utility through Perl. ...
    (perl.beginners)
  • Re: Executing commands through Perl
    ... Its my first time using Perl and I would like some ... actually program names) to yum, to be installed into a Unix machine. ... I'm extracting the names using "split" command and pushing ...
    (perl.beginners)
  • Re: [OT] Re: Placement of {
    ... > Today, for the first time in my life, I'm half my father's age. ... > My STLFilt tool's main component is written in Perl. ... indexes into hashes of hashes of hashes of hashes of hashes...., ... Before you start the next Perl program, ...
    (comp.lang.cpp)
  • Re: sed/awk, instead of Perl
    ... Perl for sed-ly stuff. ... wump$ ls -l Desktop/klog ... sys 0m0.250s ... The very first time I ran this, ...
    (freebsd-questions)