develooper Front page | | Postings from April 2002

Re: Please explain

Thread Previous | Thread Next
April 8, 2002 15:11
Re: Please explain
Message ID:
On Mon, Apr 08, 2002 at 09:52:41PM +0000, Jean-Pierre wrote:
> Le Lundi 8 Avril 2002 20:47, Yanick a écrit :
> >
> > map$1{join$|,sort/./g}.=$_,sort<>;
> >
> > what it means is simply:
> >
> Thks to you Yanick, and to Stephen. I think the answer to my question is so 
> obvious you cannot imagine I do not know it, or maybe the question was badly 
> formulated.
> Let me expose it again:
> done "feeling", sort/./g give "eefgiln" ... ok
> My question : why these programs choose to print "fleeing" and not "feleing" 
> or "leefing" or another letters permutation ? I suppose there is a dictionary 
> anywhere, who say "feleing is not a good word, fleeing is a good one".  Where 
> is it, what is this magic mechanism? Is it a Perl functionality, if yes where 
> is it described?

	Ah. Z'I understand.

	'eefgiln' is a key in the hash. It's associated value (In this case
"feeling\nfleeing\nleefing") is where the "good words" are stored,
and that's what it printed at the end of the day.

	"But Yanick," I hear you say, "aren't you doing
'map$g^s/\s\b/ /g||print,sort%1' that will iterate through both
keys and values of the hash? 

	"Well noticed," I will reply, and then reveal that the hash's 
keys are prevented of being printed by the same chicanery that 
prevent words without anagrams to be printed.

	So, to summarize, there is no dictionary magic, just 
unwholesome programming dirty tricks. :)


FUTURE, n.  That period of time in which our affairs prosper, our
friends are true and our happiness is assured.
                    - Ambrose Bierce, The Devil's Dictionary

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About