$pattern1 = "<name>.*</name>"; $pattern2 = "<age>43</age>"; $file = "data.xml"; $sep = "\n"; open(IN,"<$file"); chomp(@content=<IN>); close IN; $list = join ($sep,@content); if ($list =~ m/$pattern1$sep$pattern2/gi){ print "\n::$&::\n"; print "\n::$1::\n"; print "\n::$2::\n"; }I found only one entry but there are more. Perhaps the join function is not the right in my case, but I didn't know how to look up in an array in my special case, because the two tags are in the array two elements. Please help me. thanks in advance cybär
In reply to I want to find a group of pattern in a xml file by cybär
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |