Perl: the Markov chain saw | |
PerlMonks |
global vars and one linersby punkish (Priest) |
on Sep 15, 2009 at 00:32 UTC ( [id://795252]=perlquestion: print w/replies, xml ) | Need Help?? |
punkish has asked for the wisdom of the Perl Monks concerning the following question: So, I am trying to learn one liners. I start with the following trivial script that loops over a DATA handle and prints out all the uniq words.
Now, I want to convert this into a one liner, assuming the words are in a separate file called words.txt. So, I tried the following and failed
The reason, of course, is that %i is not remembered from one iteration to the other. How do I create this one liner?
--
when small people start casting long shadows, it is time to go to bed
Back to
Seekers of Perl Wisdom
|
|