[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[SOLUTION] Current Temperature (#68

email55555 email55555

3/1/2006 10:05:00 PM

My one-line solution.
Just join the below 4 lines become one single line; even no need space
when join lines.

require'open-uri';puts (ARGV.size !=1)?"Usage: #$0 <zip code>":
("The temperature in #$1 is #$2 degrees F."if
%r|Weather</b> for <b>(.*?)</b>.*?(\d+)&deg;F|=~
open("http://www.google.com/search?hl=en&q=tem...{ARGV[0]}"){|f|f.read})


2 Answers

Shane Emmons

3/1/2006 11:15:00 PM

0

Semi-colons, that is so cheating. :-)

dave

3/2/2006 8:21:00 AM

0


| Semi-colons, that is so cheating

require("open-uri") && puts((ARGV.size !=1) ? "Usage: #$0 <zip code>": ("The
temperature in #$1 is #$2 degrees F." if %r|Weather</b> for <b>(.*?)</b>.*?
(\d+)&deg;F|
=~open("http://www.google.com/search?hl=en&q=tem...{ARGV[0]}"){|f|
f.read}))


This is without semi-colons :)


--
>here are more things in heaven and earth,
horatio, than are dreamt of in your philosophy.


--
Email.it, the professional e-mail, gratis per te: http://www....

Sponsor:
DVD vergini: acquista online a prezzi vantaggiosi!
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=4589...