[Date Prev][Date Next][Thread Prev][Thread Next]
[Search]
[Date Index]
[Thread Index]
Re: [FWP] president
At 02:05 PM 11/8/00 -0800, Chicheng Zhang wrote:
>I saw a post today:
>
>#!/bin/sh
>echo -n 'Bush winning by '
>lynx -dump http://www.cnn.com/ | grep -2 PRESIDENT | perl -e '
>while(<>){$n[$i++] = $1.$2.$3 if /\s(\d),(\d{3}),(\d{3})/}print $n[0]-$n[1];'
>echo ' votes in Florida.'
>
>my version in perl part:
>...|perl -ne'END{print$n[0]-$n[1]}$n[$i++]=$1.$2if/,(\d{3}),(\d{3})/'
>...
>
>(since the number of votes are so close:))
>
>i believe there are better solutions, please respond.
Leaving off-topic issues such as who's running aside :-) a Perl-only solution:
perl -MLWP::Simple
-le'@a[0,1]=get("http://cnn.com")=~/([\d,]{9})/g;$"="-";s/,//g for@a;print
eval"@a"'
--
Peter Scott
Pacific Systems Design Technologies
==== Want to unsubscribe from Fun With Perl? Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
==== unsubscribe
- References:
- [FWP] president
- From: Chicheng Zhang <me@c679327-a.enclv-mdu1.sfba.home.com>