Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Lovesong

by giulienk (Curate)
on Dec 11, 2001 at 21:04 UTC ( #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

Comment on Lovesong
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
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? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2014-10-02 02:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (43 votes), past polls