如何使用Perl变量读取目录和子目录?
问题描述:
我有以下代码如何从文本文件中读取内容并使用perl检查目录和子目录名称是否存在。
注意: result_file.txt有contents.Each内容表示当前位置的目录/子目录。
我尝试过:
I have the below code how can i read the contents from the text file and check with directories and sub directories names exists or not using perl.
Note:result_file.txt has contents.Each contents denotes the directories/subdirectories in the current location.
What I have tried:
<pre>open( my $fh2, '<', "result_file.txt" ) || die( $! ))
{
while ( my $row = <$fh2> ) {
chomp $row;
my $dir = $row;
print $dir,"\n";
#print "****$row****";
}
close($fh2);
}
答
fh2,'<',result_file.txt)||死(
fh2, '<', "result_file.txt" ) || die(
!))
{
while(my
! )) { while ( my
row =<
row = <