in reply to Matching with 'if' inside a 'for' loop

A simple approach:
for my $ref ( @records ) { if ($ref->{URL}) { print qq{<B>Webpage:</B> <A HREF="$ref->{URL}">$ref->{URL}</A> +<br>}; } }
But I think you're asking for an approach that puts the check for URL in the foreach line:
for my $ref ( grep $_->{URL}, @records ) { print qq{<B>Webpage:</B> <A HREF="$ref->{URL}">$ref->{URL}</A><br> +}; }
I combined the print statements into a single print of a single string, and used qq{} to avoid having to escape the double quotes.

That's two ways to do it...