>> Delete Reply from No. 955 article
No. RE: 간단한 영어 사전. perl version입니다.

등록 2001-01-25 19:39:00     조회 4
이름 김민균    

		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