Lovesong by The Cure
#!/usr/bin/perl
@lovesong = qw(L o v e s on g);
while (($_= <DATA>) && chomp && $_)
{$.<=@lovesong ? ${$lovesong[$.-1]} = $_ : push @love, $_}
@song = @lovesong[-3..-1];
$lovesong = length($L.$o.$v.$e.$s.$on.$g) - @love ** 2;
print $L."\n"x2;
for ((split //, $s)[0..4]) {
if (ord(lc) <= $lovesong) {
printf ("$o\n$v\n", $love[$j++]) for 0..1;
} else {
my $i;
print ((ord(lc) <= $lovesong? $e : ${$song[$i++]}) . "\n" )
for (reverse split //, (split / /, $s)[0]);
}
print "\n";
}
__DATA__
Lovesong
Whenever I'm alone with you
You make me feel like I am %s again
I will always love you
However far away
However long I stay
Whatever words I say
home
whole
young
fun
free
clean
Update: better split in outer
for and fixed too long
DATA. Fixed an excessive
{ thanks to
tye
gkinueliileunikg