[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[FWP] president



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.

--c.c.



==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe