in reply to Just Another Pricey Holiday
Your code is a bit flawed. You are not guaranteed to have $some_play=1 after you buy expensive things. Allow me to alter your code a bit:
Of course, your mileage may vary. ;)#!/usr/bin/perl # Just Another Pricey Holiday # # My beloved's pricey holiday # Pushing for expensive things always # But I bought those gifts # In double shifts # So tonight I'll guarantee some play... # # -higle my $beloveds_pricey_holiday = "Valentine's Day"; until ( $some_play ) { push @expensive_things, buy(qw{those gifts}); $some_play = 1 if &whim_of_significant_other; } sub buy() { push @shopping_cart, shift; push @shopping_cart, shift; } sub whim_of_significant_other { if (rand > 0.9) { return 1; } else { return 0; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Just Another Pricey Holiday
by ehdonhon (Curate) on Feb 15, 2002 at 14:57 UTC |
In Section
Perl Poetry