http://qs1969.pair.com?node_id=782615


in reply to find acronyms in a text

$_ =~ s/\s+//; my @Elements = split /\s/;

You are first removing all white space from the input, and then try to split on white space???? This doesn't make sense to me.

-- 
Ronald Fischer <ynnor@mm.st>

Replies are listed 'Best First'.
Re^2: find acronyms in a text
by davorg (Chancellor) on Jul 23, 2009 at 10:22 UTC
    You are first removing all white space from the input

    I thought that at first too. But he's only removing the first run of whitespace from each record he reads in.

    --

    See the Copyright notice on my home node.

    Perl training courses

      he's only removing the first run of whitespace

      Of course! No g modifier! I did not pay close attention...

      -- 
      Ronald Fischer <ynnor@mm.st>
Re^2: find acronyms in a text
by steph_bow (Pilgrim) on Jul 23, 2009 at 10:23 UTC

    Sorry, you are right and I have updated my programm

    I wanted to remove the new line character at the end of each line

      I wanted to remove the new line character at the end of each line

      See chomp.

      But does a Word document contain anything that Perl would recognise as a newline character? I don't know anything about that file format.

      --

      See the Copyright notice on my home node.

      Perl training courses