in reply to How to remove the spaces after the directory name and before the .html extension from my code using perl?

Most likely, you read the space already in from your file into $line and then @data. Remove the spaces from the file.

  • Comment on Re: How to remove the spaces after the directory name and before the .html extension from my code using perl?
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: How to remove the spaces after the directory name and before the .html extension from my code using perl?
by gpssana (Initiate) on Apr 13, 2017 at 09:38 UTC
    $word=~s/("\S+|\S+|")\s*/$1/g;
    I had used the above thing to remove the spaces .

      And did that remove all spaces from $word?

      How did you verify that that removed all spaces from $word?

      I suggest that, as an exercise, you write a short program that removes all whitespace from a list of "interesting" words in an array. This will teach you how to investigate and verify your assumptions about your data and your program.