in reply to Calling functions in middle of CGI HTML declarations

You can use map:
map { div($_) } @fields