#!perl use warnings; use strict; use HTTP::Headers; use 5.012; my $headers = HTTP::Headers->new(); $headers->header( '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' => '; rel="self"', 'Link' => '; rel="next"', ); say "Found link headers:"; for my $h ( $headers->header('Link') ) { if( $h =~ /\brel="next"/ ) { say "Found 'next' link: $h"; } else { say "Ignoring other Link header: $h"; }; }; __END__ Found link headers: Ignoring other Link header: ; rel="self" Found 'next' link: ; rel="next"