私はラインを持っています
CHANNEL(SYSTEM.DEF.SVRCONN) CHLTYPE(SVRCONN)
id=3
私がやりたいのは、ファイルを検索して最初の行を見つけた後、IDを取得することです。
open(CHECKFILE8, "$file");
while (<CHECKFILE8>) { #while loop to loop through each line in the file
chomp; #take out each line by line
$datavalue = $_; #store into var , $datavalue.
$datavalue =~ s/^\s+//; #Remove multiple spaces and change to 1 space from the front
$datavalue =~ s/\s+$//; #Remove multiple spaces and change to 1 space from the back
$datavalue =~ s/[ \t]+/ /g; #remove multiple "tabs" and replace with 1 space
if ($datavalue eq "CHANNEL(SYSTEM.DEF.SVRCONN) CHLTYPE(SVRCONN)") {
# HOW TO READ THE NEXT LINE?
}
}