in reply to Re: Re: Re: creating all possible random 'words' from 4 letters
in thread creating all possible random 'words' from 4 letters

If you don't want them all in one list, just call glob in a scalar context and it will act as an iterator for you.

...but will still need to build the entire (easily huge) list into RAM, just not inside of Perl (and so will still fail except for near-trivial cases).

                - tye
  • Comment on Re^4: creating all possible random 'words' from 4 letters (pass buck)

Replies are listed 'Best First'.
Re: Re^4: creating all possible random 'words' from 4 letters (pass buck)
by BrowserUk (Patriarch) on Nov 07, 2003 at 19:36 UTC

    Oh. Is that right? That wasn't how I read the POD for glob -- how disappointing.

    Thanks for setting me straight.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    Hooray!
    Wanted!

      I wasn't sure if BrowserUk was being sarcastic or not...OK, I've decided he was playing straight.

      Yes, a quick check of 5.8.0 shows that this takes a long time to finish:

      foreach ( glob( "{a,b,c,d}" x 10 ) ) { print "$_\n"; last; }
      while this finishes immediately:
      foreach ( 'aaaaaaaaaa'..'dddddddddd' ) { print "$_\n"; last; }
      I'll leave it to OMAR to check the memory use :)

      -QM
      --
      Quantum Mechanics: The dreams stuff is made of