#$ shifting themes, upon first glance #
# can the heart and soul really keep #
# up with the themes of our lives? $#
our @themes = qw(
fuel fire
flame hot
air water
earth spirit
desire love
happiness peace
);
our $poem = q(
from heart comes soul
thus the heart is truly soul
for without heart, one cannot have soul
and without soul one returns to the heart
one soul, one heart
no heart, no soul
);
while(my $heart = shift @themes and my $soul = shift @themes)
{ $poem =~ s/heart/$heart/ && $poem =~ s/soul/$soul/ }
print $poem;
#$ is the theme shifting, #
# or does it remain the same? $#
(UPDATE: This doesn't quite capture the grace of
osfameron's implementation, but it's a little cleaner
than it was before)