Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: making a markovian "mad lib"

by trippledubs (Deacon)
on Mar 21, 2019 at 02:38 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1231516]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-19 23:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found