>> Edit article
이름
제목
패스워드
shell script, python 이 나왔으니 perl도 빠질 수 없죠? ^^ 제가 써오던 영어사전입니다. 그럼. ---------------------------------------- #!/usr/bin/perl use IO::Socket; if ($#ARGV < 0) { die "eng <word>" } $server = "kr.engdic.yahoo.com"; $word = $ARGV[0]; $remote = IO::Socket::INET->new(Proto=>"tcp", PeerAddr=>$server, PeerPort=>"80", Reuse=>1) or die "Can't connect to "$server""; # set buffering off $remote->autoflush(1); $nl = chr(13).chr(10); $end = chr(13).chr(10).chr(00)x4; $header = "GET /result.html?p=$word HTTP/1.1$nl"; $header .= "Host: kr.engdic.yahoo.com$nl"; $header .= "$end"; # write HTTP request to server print $remote $header; # recieve everything the server sends, and print it to the screen $i=0; while ($line = <$remote>) { if( $i < 83 ){ $i++; next; } if ($line =~ /^<br>$/){ last; } $line =~ s/<(?:[^>'"]*|(['"]).*?1)*>//gs; # strip all html tags. print $line; } close $remote;
Copyleft
1999-2026 by
JSBoard Open Project
Theme Designed by
IDOO
All right reserved