V Việt Quân New member Sep 17, 2021 #1 What does the following segment of code output? Code: $string1 = "Hello World\n"; if ($string1 =~ m/(H..).(l..)/) { print "We matched '$1' and '$2'.\n"; } A. We matched ‘Hel’ and ‘ld’ B. We matched ‘Hel’ and ‘lld’ C. We matched ‘Hel’ and ‘lo ‘ D. None of the mentioned
What does the following segment of code output? Code: $string1 = "Hello World\n"; if ($string1 =~ m/(H..).(l..)/) { print "We matched '$1' and '$2'.\n"; } A. We matched ‘Hel’ and ‘ld’ B. We matched ‘Hel’ and ‘lld’ C. We matched ‘Hel’ and ‘lo ‘ D. None of the mentioned
P Phan Văn Khánh New member Sep 17, 2021 #2 Answer: C Explanation: () groups a series of pattern element to a single element. When we use pattern in parenthesis, we can use any of ‘$1’, ‘$2’ later to refer to the previously matched pattern. Upvote 0 Downvote
Answer: C Explanation: () groups a series of pattern element to a single element. When we use pattern in parenthesis, we can use any of ‘$1’, ‘$2’ later to refer to the previously matched pattern.