OneLiner

素因数分解ワンライナー

1行素因数分解 - すぎゃーんメモで挑戦した、ワンライナーで素因数分解。 今日ふと、サブルーチンを定義して再帰的に処理することなくやる方法が思い浮かんだ。 より短くエレガントに(?)なった気がする。 $ perl -e '$n = pop; print "$a[0] * " and $n /=…

焼肉ワンライナー

YAKINIQUEST - ヤキニクエスト 焼肉 焼き肉 様から取得 $ perl -MLWP::Simple -le '/東京/ and push @a,$_ for split($/,get "http://www.yakiniquest.com/-/all"); print $a[rand @a]' 最新焼肉番付 --東京焼肉ものがたり-- 様から取得 $ perl -MLWP::Simpl…

1行friends_timeline取得

Twitter perl -MHTTP::Request -MLWP::UserAgent -MJSON -MEncode -le '($r=HTTP::Request->new(GET=>"http://twitter.com/statuses/friends_timeline.json"))->authorization_basic("username", "password"); print $_->{user}->{screen_name}." : ".encode…

1行素因数分解

ふと気になって調べてみたけどワンライナーがあまり見つからなかったので自分で考えてみた perl -e 'sub f{return $a if ($a=$_[0]) < 3; $a%$_ or print f($a/$_),"*$_" and return for (2..$a-1); $a} f(shift)' 20092時間近く相当悩みながら短くしていっ…