가능한 중복 :
Why does Perl's glob return undef for every other call?글로브 건너 뛰는 파일
이 나는 긴 이름을 가진 파일을 찾을 필요가 내가 가진 한 또 다른 문제의 연속이다하지만 내가 알고있는 것을 이름의 일부는 여기에 사용 된 코드입니다.
my @RTlayerRabcd = ("WIRA_Rabcd_RT","WIRB_Rabcd_RT","WIRC_Rabcd_RT","WIRD_Rabcd_RT","WIRE_Rabcd_RT","BASE_Rabcd_RT");
#Rabcd calculations
for($i = 0; $i < 6; $i++)
{
print "@RTlayerRabcd[$i]\n";
#Searching for Rabcd Room Temperature readings
my $file = glob($dir . "*@RTlayerRabcd[$i]" . '.txt');
print "$file\n";
my $Rtot = 0;
#Open file, Read line
open (FILE, $file);
while (<FILE>)
{
#read line and and seperate at "tab" into $temp, $Res
chomp;
($Res, $temp) = split("\t");
$j++;
$Rtot=$Res+$Rtot;
}
close (FILE);
$Ravg = $Rtot/$j;
print FILE_OUT "$Ravg \t";
}
코드를 실행 한 후 다음 p 인쇄물 출력 :
WIRA_Rabcd_RT
Vesuvious_C6R8_051211/vesu_R6C8_05112011_WIRA_Rabcd_Rt.txt
WIRB_Rabcd_RT
WIRC_Rabcd_RT
Vesuvious_C6R8_051211/vesu_R6C8_05112011_WIRC_Rabcd_Rt.txt
WIRD_Rabcd_RT
WIRE_Rabcd_RT
BASE_Rabcd_RT
Vesuvious_C6R8_051211/vesu_R6C8_05112011_BASE_Rabcd_Rt.txt
프로그램이 파일을 건너 뛰는 것 같습니다. 이유는 무엇입니까?
사용이 엄격하고 경고, 당신의'개방에 조건부()를 사용합니다', 당신은 몇 가지 정보를 얻을 수 있습니다. 분명히 글로브는 파일을 찾지 못합니다. 또한. '@array [0]'이 아닌'$ array [0]'은 배열 요소를 참조하는 방법입니다. – TLP