The idea is old, it's just a programming exercise. Thanks for pointing me t= o the docs and "travesty". Now I have the idea of implementing another variable which allows the user to determine how many characters the script will fetch (fixed or random number). Thanks a lot! Michael > Von: Ronald J Kimball <rjk@linguist.dartmouth.edu> > Datum: Sun, 27 Feb 2000 23:28:57 -0500 > An: miku <miku@onlinehome.de> > Cc: Mac Perl <macperl@macperl.org> > Betreff: Re: [MacPerl] poets mix problems >=20 > On Sat, Feb 26, 2000 at 10:47:17PM +0200, miku wrote: >> The idea of the program is to read in all writers' texts into one single >> string, let the user input a starting string of random length and then h= ave >> her/him input how many new characters in the style of the writers there = are >> to be produced. Then the script scans the single-line text (called >> "wholetext") for all appearances of the starting string and collects all >> letters *following* this starting string within "wholtext". Out of this = set >> (if it's empty, a random letter is invented) the script then chooses one >> character by random =AD a new character to output is born. Then, for the= next >> character to be invented, the script appends the newly found character t= o >> the starting string and in turn trashes its first letter. So a new >> "starting" string is created. And now the seach begins anew, until the >> needed number of new characters is printed on-screen and, simultaneously= , >> into a file. The result, I think, should be very funny, and - with >> increasing length of the starting string - create more and more of an >> approximation to the original texts. For instance, a starting string of >> length 4 would create a more random (and somewhat erratic or cryptic) pi= ece >> of literature than a starting string of length 9 or 10 which would be mu= ch >> more determining. >=20 > Sounds sort of like travestry, which is in the eg/ directory of the Perl > distribution. That one works on words, though, whereas yours will work o= n > characters. >=20 > MacPerl doesn't come with the eg/ directory. You can download travesty a= t > <http://linguist.dartmouth.edu/~rjk/travesty>. This is the version from > Programming Perl, 1st ed. (with one bug fix). It will run until > terminated. >=20 >=20 >> More to the point, my problem is: if I do a pattern search, non-letter >> non-number characters like "." within the starting string might be >> interpreted as wildcards or other embedded options/commands >> (meta-characters). How can I make the search interpret its pattern as a >> plain-text string that might contain *all* 256 characters of my characte= r >> set? >=20 > /\Q$regex/ >=20 > See the documentation of quotemeta in perlfunc and \Q in perlop. >=20 >=20 >> And how can I construe and apply a mapping function that extracts all >> single characters following the starting string in "wholetext"? >=20 > @matches =3D $wholetext =3D~ /(?=3D\Q$starting_string\E(.))/gs; >=20 > I use a positive lookahead asserion, (?=3D), because the starting string = may > overlap with itself. For example, if the starting string is 'abab', and > wholetext is "XXXabababbXXX", there are two occurences of 'abab', which > happen to overlap. The first is followed by 'a', and the second is > followed by 'b'. >=20 >=20 > Ronald >=20 > # =3D=3D=3D=3D=3D Want to unsubscribe from this list? > # =3D=3D=3D=3D=3D Send mail with body "unsubscribe" to macperl-request@ma= cperl.org >=20 >=20 # =3D=3D=3D=3D=3D Want to unsubscribe from this list? # =3D=3D=3D=3D=3D Send mail with body "unsubscribe" to macperl-request@macp= erl.org