in reply to space in front of lines

$text = join(' ',@LINES);

Maybe you shouldn't ask Perl to join the lines with spaces separating them then :)

--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Replies are listed 'Best First'.
Re: Re: space in front of lines
by wolverina (Beadle) on Nov 06, 2002 at 00:30 UTC
    I tried all the suggestions.. including chomp does nothing, and removing the join line: $text = join(' ',@LINES); creates an empty file except for the number 70 which is strange. I think i may have to use a pattern matching operator to remove the spaces, but i'm not sure exactly where to insert it. -Lisa

      I think you misunderstood me. I'm not suggesting that you remove that line of code completely (obviously that's going to change the way your program works), just that if you ask Perl to join the lines separated by a space then you shouldn't be surprised if you get a space separating each lne :)

      If (as it seems) you want to join the lines, but not get the space separating them, then ask Perl to join them with an empty string as the separator.

      $text = join('', @LINES);
      --
      <http://www.dave.org.uk>

      "The first rule of Perl club is you do not talk about Perl club."
      -- Chip Salzenberg

        thanx.. that did the trick.. wagging tail. -Lisa