Francesco Stablum wrote: > Hello everyone, > > i'm a newbie, and I'm trying to write a simple perl script that takes > the stdin and prints it to stdout adding colors that alternates on odd > and even lines. > The problem is that the newline charachter seems to align to the next > line colors and not of the current. > > [code] > use Term::ANSIColor; > foreach(<STDIN>){
chomp; my $c = (++$i % 2 == 0)? 'white on_black' : 'black on_white'; print colored ($_, $c), "\n"; > $c = (++$i % 2 == 0)? 'white on_black' : 'black on_white'; > print colored ($_, $c); > } > [/code] > > Is it a flushing problem? I cannot understand why. Do you? The \n should be outside of colored(). -- Just my 0.00000002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. I like Perl; it's the only language where you can bless your thingy. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/