Ever had the problem of not knowing what to do? Perl and to the rescue...

use strict; use warnings; use LWP::Simple; my ($szConumdrum, $szThisSolution, @solution, $URL, $iRandom); print 'Conundrum: '; chomp ($szConumdrum = <STDIN>); while () { print 'Solution: '; chomp ($szThisSolution = <STDIN>); last if $szThisSolution eq ''; push @solution, $szThisSolution; } $URL = "$#soluti +on&col=1"; print "Deciding...\n"; $iRandom = get($URL); die "Unable to decide!\n" if not defined $iRandom; print "The solution to '$szConumdrum' is '$solution[$iRandom]'\n"; __END__

I was in two minds about posting this code and so I thought I would ask the script itself. The following is honestly the result...

Conundrum: Should I post this code to PM? Solution: Yes Solution: No Solution: Deciding... The solution to 'Should I post this code to PM?' is 'Yes'

The ether can't be wrong.


Update: Changed the code based on jdporter's suggestion in the chatterbox; "you should probably use $#solution, rather than @solution - 1. And you can interpolate it directly".