I am trying to format the output inside Perl Script. So I want to rewrite the text in the console. I already got it to rewrite the line, but I cannot go back to another line. for example
print "test\ntest"; print "\rhi ";
Will be displayed
Test Hi
What I know, wants to do, goes further, so that instead of the second test, the first test can be replaced. \ b does nothing in my console, is there any other way to get back to the line on Windows CMD?
print "\e[H"; # Put the cursor on the first line print "\e[J"; # Clear from cursor to end of screen print "\e[H\e[J"; # Clear entire screen (just a combination of the above) print "\e[K"; # Clear to end of current line (as stated previously) print "\e[m"; # Turn off character attributes (eg. colors) printf "\e[%dm", $N; # Set color to $N (for values of 30-37, or 100-107) printf "\e[%d;%dH", $R, $C; # Put cursor at row $R, column $C (good for "drawing")
Also see
, , , . .
#!/usr/bin/perl -w use strict; my $output="Hi"; #local $| = 1; print "test\ntest"; print ("\b" x length("test")); for(my $i=0;$i<length("test");$i++) { $output .=" "; } print $output;
:
D:\Study\perl>perl test1.pl test Hi
\b 4 , "" 4., , , 4 . "hi" 4, 2 , , "Hist";
Source: https://habr.com/ru/post/1605705/More articles:Android video hardware accelerator for H264 stream - androidHow to save changed data in the Curve Fitting Toolbox? - matlabHow to send a push notification via GCM to an iOS device? - iosShare iOS extension not working - iosSave socket response to string in Perl - stringLaravel 5 controller naming convention - phphow to add angular radius and addition to multi-line stretchable text - androidIs it possible to use text-to-speech using the Apple Watch WatchKit? - iosHow to programmatically manage a sound card? - pythonHow to combine an array of hashes by prioritizing non-nil values - ruby | fooobar.comAll Articles