Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Lovesong

by giulienk (Curate)
on Dec 11, 2001 at 21:04 UTC ( [id://130974]=poem: print w/replies, xml ) Need Help??

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: poem [id://130974]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-20 06:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found