[Perl] simple print question.
Hello all.
I have a little problem with print command, like this: Code:
#!/usr/bin/perl Code:
slax ~ # /Desktop/hello.pl Code:
slax ~ # /Desktop/hello.pl Cheers //// |
By default, tty drivers print from left to right. You have to pad with whitespace, or use escape characters (ANSI escape sequences) to move things to wierd positions on the screen like that. So, the problem is not related to perl really. What exactly are you trying to do?
For escape sequences see: http://www.dee.ufcg.edu.br/~rrbrandt/tools/ansi.html You can use the COLUMNS environment variable to get your screen width. |
Quote:
Then it matches those extracted links with different regexes that I have written/borrowed from different intrusion detection systems. I show few pics, easier that way for me :p It prints like this now: http://img340.imageshack.us/my.php?image=ssim2.png I would like to print like this: http://img255.imageshack.us/my.php?image=ssmodbf0.png My problem is that those url's are different length so I cant use any kind of tabs or whitespaces. Code:
print colored ("$url", $script_color); ///// |
try something that creates a filler padded dynamically with spaces:
Code:
my $cols = 128; |
Hi, I managed to get it to work. Thanks for hints about ansi codes.
Just change the length of that $url string and it still prints timestamps at the right place. Code:
#!/usr/bin/perl -w Cheers, ///// |
All times are GMT -5. The time now is 04:26 AM. |