in reply to Noob's question

We really need a bit more information: HOW "doesn't (it) work as (you) expected?
  1. Spew warnings; spit errors.... or what?
  2. and what OS is this running under?
  3. and HOW are you entering the input -- as a set of words on the CLI invoking the code, properly quoted; as individual words once the code is running; by telephathic instantiation?
See, among other FAQs about how to ask (and title) a question How do I post a question effectively? and I know what I mean. Why don't you?.

BTW, your code works as expected, when used to process input in the manner you've specified with <STDIN>... which is not the same way as it would work were you trying to process @ARGV.


++$anecdote ne $data


Replies are listed 'Best First'.
Re^2: Noob's question
by gonny95 (Initiate) on Sep 27, 2014 at 14:25 UTC

    Sorry I saw the output wrong. Actually It seems to work fine. And next time I will write more detailed question thanks!

      Sorry I saw the output wrong. Actually It seems to work fine.

      I find it highly unlikely that your code works, considering it's very likely to go into an infinite loop...