Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: making a markovian "mad lib"

by trippledubs (Deacon)
on Mar 21, 2019 at 02:38 UTC ( #1231516=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    for (@{$data}) {
        my $key = $_->[0];
    ...
        my $random = $_->[rand($#{$_}) + 1];
        $vars{$key} =  $random;
    }
    
  2. or download this
    %vars = map { $_->[0],$_->[rand($#{$_}) + 1] } @{$data};
    
  3. or download this
    $story = {
          protaganist => [ 'al debaran','narrator','japh','gilligan' ],
          dog => [ 'my pretty pitty' ],
    };
    
  4. or download this
    data/protaganist.txt
    al debaran
    ...
    data/trials.txt
    adventures
    bedraengisse
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1231516]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2021-03-03 05:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (73 votes). Check out past polls.

    Notices?