-1
自分のために正常に動作するコードを持っていますが、別の関数と組み合わせるとこのエラーメッセージが表示されます。 "Tk :: Error:Can not use open_gui.pl行231でHASH参照としての未定義の値。 "行231はこの行です。 "my $ output - > {$ count} = unpack( 'C'、getc($ otp));"以下は私のコードですTk :: Error:HASHとして未定義の値を使用することはできません
sub main($$){
my $call_form = shift ;
my $file1 = shift -> get() ;
my $output={};
bless $output;
my $j =0;
my $i =0;
grab_file($output,$file1);
}
sub grab_file($$){
my $output=shift;
my $file = shift;
open(my $otp, '<' , "$file") or die "Error, File1 could not open\n";
open(my $input, "> info.txt") or die "Error, File3 could not open\n";
my $count = 0;
binmode($otp);
seek ($otp,829440,0);
for my $count (0..27648){
my $output->{$count} =unpack('C',getc($otp));
print $input "$output->{$count}\n";;
}
close ($input);
close($otp);
open(FILE4, ">data.txt") or die "Error, File4 could not open\n";
open (my $input, '<', "info.txt") or die $!;
chomp (my @file = <$input>);
print FILE4 join (" ",splice (@file, 0, 16)),"\n"while @file;
close($input);
close(FILE4);
}
これはコードの一部であり、コードの上部はここでは主にGUIを構築するためのtkではありません。ここに表示されていないTk関数と組み合わせないこのサブルーチンは、$ otpにバイナリファイル名を入れてもうまく動作しますが、GUIの入力からファイルを取得したいときにエラーを表示します。いずれにせよ、これを助けることができますか?ありがとう
https://eval.in/803952 => '警告を使う;'その日を保存します。 –
サイドノート、https://stackoverflow.com/a/8129070/223226 –