in reply to Re^2: Not quite an OO tutorial
in thread Not quite an OO tutorial
package Rand; use strict; use warnings; sub _random { my @values = @_; return $values[rand @values]; } sub day_part { return _random(qw(morning evening afternoon night)); } sub light { return _random(qw(bright dark gloomy dazzling)); } sub weather { return _random(qw(stormy windy rainy calm)); } sub tense { return _random('was', 'is', 'will be'); } 1;
use strict; use warnings; use Rand; my $random_day_part = Rand::day_part; my $random_light = Rand::light; my $random_weather = Rand::weather; my $random_tense = Rand::tense; print "It $random_tense a $random_light and $random_weather $random_da +y_part."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Not quite an OO tutorial
by Lady_Aleena (Priest) on Feb 24, 2011 at 07:20 UTC | |
by RedElk (Hermit) on Feb 24, 2011 at 18:44 UTC | |
by Anonymous Monk on Feb 24, 2011 at 09:08 UTC | |
|
Re^4: Not quite an OO tutorial
by Lady_Aleena (Priest) on Feb 26, 2011 at 20:01 UTC |