Of the two, I prefer the former, as it's
easy to read and hence to maintain.  In
fact, I'd make it clear by 

$html.=<<"__END_OF_HTML__";

Put it $here
like so....

__END_OF_HTML__


Lee
---
Obligatory perl schmutter .sig:
perl -e "print rand > 0.5 ? q/\\/ : q\/\ while 1"

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of
> Matthew Thompson
> Sent: 26 June 2001 14:53
> To: Perl Web (E-mail)
> Subject: effiency in string formatting???
> 
> 
> Hi all, 
> Any one had any comments on this lot of code:
> 
> ---------------------------
> 
> $html="start of html code";
> 
> foreach $_ (@users) {
>       chomp($_);
>       ($name, $pass, $privelages) = split(/:/, $_);
>       $html.="<TR><TD><INPUT TYPE=\"radio\" NAME=\"user\" VALUE=\"";
>       $html.=$name;
>       $html.="\"></TD>\n<TD>\n";
>       $html.=$name;
>       $html.="</TD><TD>";
>       $html.=$privelages;
>       $html.="</TD></TR>\n";
> }
> $html.="rest of html code";
> print $html;
> 
> -----------------------
> 
> Is that more efficient than this
> 
> -----------------------
> 
> $html="start of html code";
> 
> foreach $_ (@users) {
>       chomp($_);
>       ($name, $pass, $privelages) = split(/:/, $_);
>       $html.="<TR><TD><INPUT TYPE=\"radio\" NAME=\"user\"
> VALUE=\"$name\"></TD>\n<TD>\n$name</TD><TD>$privelages</TD></TR>\n";
> }
> 
> $html.="rest of html code";
> print $html;
> 
> --------------------------
> 
> 
> ? Is this splitting heirs and there is no difference? Would it make a
> difference printing out straight away instead of putting it in a variable?
> I ask as I remember reading something once that the perl interpreter treats
> 'print "$name";' different from 'print $name;' and the later is more
> efficient (I think).
> 
> Cheers,
> Matt
> _______________________________________________
> Perl-Win32-Web mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to