Corion's approach is the correct one. However, since you asked using a regex on the string and have still not shown that you have learned How to ask better questions using Test::More and sample data, here is one final demonstration.
use strict; use warnings; use Test::More tests => 1; my $response1 = <<EOT; Cache-Control: no-cache, no-store Connection: close Date: Fri, 26 Mar 2021 02:11:16 GMT Pragma: no-cache Server: nginx Vary: Accept-Encoding Content-Type: application/json Expires: 0 Client-Date: Fri, 26 Mar 2021 02:11:16 GMT Client-Peer: 10.10.1.32:8080 Client-Response-Num: 1 Client-Transfer-Encoding: chunked Expect-Ct: report-uri="https://org.extract.net", max-age=0 Link: <https://sso.myorg.com/api/v5/myids?limit=200>; rel="self" Link: <https://sso.myorg.com/api/v5/myids?after=200xxxxxxxxxxxxxxxxx&l +imit=200>; rel="next" EOT my $want = '<https://sso.myorg.com/api/v5/myids?after=200xxxxxxxxxxxxx +xxxx&limit=200>; rel="next"'; my @linkheader = $response1 =~ /^Link: (.*"next")/mg; is $linkheader[0], $want;
🦛
In reply to Re: Perl to collect "Link" values contains "next"
by hippo
in thread Perl to collect "Link" values contains "next"
by chandantul
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |