in reply to 'Invisible' newlines/line wrapping

Something in my code is inserting invisible newlines into my strings in a terminal, and I would like to have any suggestions as to how to fix my code to get rid of them, or where to find such info.

code causing newline (newline 'appears' directly after $index):

if($current!=1){ say "$simple rad[$index] $current"; }

The much more plausible answer is that the value in $index ends with a newline. What's the output of

use Data::Dumper; local $Data::Dumper::Useqq = 1; print(Dumper($index));

Replies are listed 'Best First'.
Re^2: 'Invisible' newlines/line wrapping
by luolimao (Initiate) on Apr 23, 2010 at 01:47 UTC
    it prints the inputted value for $input and then "\n"
      $index=<STDIN>;

      should be

      chomp( $index=<STDIN> );

      You never removed the newline Enter produced.