我想要清除所有元素,將它們存儲在數組中,然後從該數組中刪除符號鏈接。問題是我不知道如何刪除一個數組中包含在另一個數組中的所有元素,因爲我是perl的新手。從perl中刪除另一個數組中的一個數組中的元素
貝婁是我的代碼到目前爲止。
foreach ${dir} (@{code_vob_list})
{
${dir} =~ s/\n//;
open(FIND_FILES, "$cleartool find ${dir} -type f -exec 'echo \$CLEARCASE_PN' |") or die "Can't stat cleartool or execute : $!\n"; #This command gets all files
@{files_found} = <FIND_FILES>;
open(SYMBOLIC_FIND_FILES, "$cleartool find ${dir} -type l -exec 'echo \$CLEARCASE_PN' |") or die "Can't stat cleartool or execute : $!\n"; #This command get all symbolic links
@{symbolic_files_found} = <SYMBOLIC_FIND_FILES>;
#Filter away all strings contained in @{symbolic_files_found} from @{files_found}
foreach my ${file} (@{files_found})
{
#Here I will perform my actions on @{files_found} that not contains any symbolic link paths from @{symbolic_files_found}
}
}
在此先感謝
你在哪裏學會把所有的標識符放在花括號裏面?我希望你意識到這是不必要的,我相信它會使代碼更不易讀 – Borodin
嘗試查看File :: Find查找這樣的任務。 –