$pem_cert =~ /-----BEGIN CERTIFICATE-----(?:\r\n?|\n)(.+)(?:\r\n?|\n)-----END CERTIFICATE-----/s; my $s_pem = $1;