The issue of printing to the same location is based on terminal type. You have several options on how you can implement this scenario.

1) from a text environment, you could use the codes for the proper terminal type to reposition the cursor before sending your next print statement.

2) you could also leave the \n off the end of line, use the \b to backspace, then display the next data, ex.
print "Help"; #Display Help
print "\b\b\b"; #Backspace 3 times;
print "ip Hop"; #Display should now read "Hop Hop"
print "\n"; # start a new line


3) you could use a visual programming language and be able to directly control the cursor location and position in a window environment.

4) you could use perl and some modules to write code for the windowing environments.


At 03:53 PM 1/6/2004, Esposito, Anthony wrote:
I have a perl program ( with DBI ) which prints out a line to STDOUT
after every 100 database commits.  I would like the 'print' to just
refresh the current line every time but - not knowing how to get around
it - the program instead prints a new line every 100 commits like so:



INFO 3: start deleting rows.

Rows deleted: 100

Rows deleted: 200

Rows deleted: 300

Rows deleted: 400

.

.

.

INFO 4: delete_rows.pl program ended.



I would like the output to just stay on one line and just update the
count as the program proceeds.  So the output - when done - would just
be



INFO 3: start deleting rows.

Rows deleted: 400

INFO 4: delete_rows.pl program ended.



Is there a 'print' option/escape character the sends the file pointer (
for STDOUT in this case ) back to the beginning of the line?



Here is the current code segment - the focus here is on the last 'print'
statement:



print "INFO 3: start deleting rows.\n";

while(($row_data) = $sth1->fetchrow) {

if(! defined ($sth2->execute($row_data))) { # execute DELETE

print "ERROR 4: execute of DELETE statement failed.\n";

exit(int 4);

}

$row_counter = $row_counter + 1;

if($row_counter >= 100) {

$dbh->commit;

$rows_deleted = $rows_deleted + $row_counter;

print "Rows deleted: $rows_deleted\n";

$row_counter = 0;

}

}

print "INFO 4: $0 program ended.\n";



Thanks for any help you can offer....



Tony Esposito

Oracle Developer, Enterprise Business Intelligence

XO Communications

Plano, TX 75074

Work Phone: 972-516-5344

Work Cell: 972-670-6144

Email: [EMAIL PROTECTED]



Patrick J. Shoaf, IT Manager [EMAIL PROTECTED]

Model Cleaners, Uniforms, & Apparel
100 Third Street
Charleroi, PA 15022
<http://www.model-uniforms.com/>http://www.model-uniforms.com
Phone: 724-489-9553 ext. 105
 or    800-99 MODEL
Fax:   724-489-4386




-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to