perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Peters <>
Subject Re: How to display images ?
Date Tue, 21 Aug 2007 16:02:08 GMT
Georg Grabler wrote:
> On Tuesday 21 August 2007 15:48:23 RGKärcher wrote:
>> print " <p><a href=\"\">  <img
>> src=\"site_images/$image \"  width=\"160\"
>> height=\"180\" alt=\"image \" class=\"float-left\"
>> /></a>\n";
> Perl is just a bit differnt. Either, use ${image} instead of $image or use 
> sprintf.

You can use both of those, but you don't really need to. The above should work
just fine. But don't all those escapes of the double quotes give you a headache?
There are so many better ways of doing that:

print qq|<p><a href="">
  <img src="site_images/$image" width="160" height="180" alt="image"
    class="float-left" />

Having said that, when working with HTML you should really be using templates. I
like Template Toolkit ( and also use
HTML::Template ( but if you're
coming from PHP then Mason might be more up your alley

Michael Peters
Plus Three, LP

View raw message