下記($str1)のように、英文が混じっています。
その中から、英語だけの文字を取り出すことは、できないでしょうか?
もし、簡単なサブルーチンなどご存知でしたら教えてください。
宜しくお願い致します。
$str1 = "さま z a マ な mo じ が ハイ っ ています。";
$str2 = &omit($str1);
sub omit{
}
print "$str2";
結果出力
---------
z a mo
Tk を使って、あるサブルーチンの実行前にポップアップを出し、終了後にラベルの文字列を変えるという操作をしたいのですがうまくいきません。解決法をご教示願えましたらうれしいです。
use Tk;
use Net::FTP;
my $mw = MainWindow->new(-title => "Test");
my $comment = "Please wait ...";
my $label = $mw->Label(-textvariable => \$comment)->pack( );
MainLoop;
&download;
$comment = "Downloaded";
sub download{
open IDIN, "< id.txt" or die "Cannot open file";
my $ids = <IDIN>;
close IDIN;
my ($host,$idname,$pswd) = split(',',$ids);
my $ftp = Net::FTP->new($host, Debug => 0)
or die "Cannot connect to some.host.name: $@";
$ftp->login($idname,$pswd)
or die "Cannot login ", $ftp->message;
$ftp->get("sample.txt")
or die "get failed ", $ftp->message;
}
Tk を使って、あるサブルーチンの実行前にポップアップを出し、終了後にラベルの文字列を変えるという操作をしたいのですがうまくいきません。解決法をご教示願えましたらうれしいです。
use Tk;
use Net::FTP;
my $mw = MainWindow->new(-title => "Test");
my $comment = "Please wait ...";
my $label = $mw->Label(-textvariable => \$comment)->pack( );
MainLoop;
&download;
$comment = "Downloaded";
sub download{
open IDIN, "< id.txt" or die "Cannot open file";
my $ids = <IDIN>;
close IDIN;
my ($host,$idname,$pswd) = split(',',$ids);
my $ftp = Net::FTP->new($host, Debug => 0)
or die "Cannot connect to some.host.name: $@";
$ftp->login($idname,$pswd)
or die "Cannot login ", $ftp->message;
$ftp->get("sample.txt")
or die "get failed ", $ftp->message;
}
usr strict;
をつかって、
$protocol_name = "pppoe";
@{$protocol_name}
のような使い方をしたいと思っていますが、
Can't use string ("pppoe") as an ARRAY ref while "strict refs" in use at ./ctest.pl line 152, <RCFG2> line 7
のようにエラー表示がでてしまいます。
どうしたら回避できるでしょうか。
Perlでアクセスカウンターを作ろうと思っています。
そこでファイルオープンを勉強し、
CGIプログラムを実行しようとしたところ、
エラーが起こりました。↓
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, ********@*********(伏せてあります) and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
------------------------------------------
Apache/2.0.55 (Win32) Server at 127.0.0.1 Port 80
ソースを見てもおかしい所は見当たりません…↓
#! c:/perl/bin/perl
open(FILE, "./sample.txt");
@data = <FILE>;
close (FILE);
print <<END;
Content-type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>sample</title>
</head>
<body>
<p>$data[0]</p>
<p>$data[1]</p>
<p>$data[2]</p>
</body>
</html>
END
サーバーはApacheを使っています。
原因がわかったら教えてください。
よろしくお願いします。