[pm-h] relocate metatags in hyperlatex-generated HTML

G. Wade Johnson gwadej at anomaly.org
Sun Feb 11 20:45:29 PST 2007


On Sun, 11 Feb 2007 19:55:30 -0600
"Russell L. Harris" <rlharris at oplink.net> wrote:

> * G. Wade Johnson <gwadej at anomaly.orgq> [070211 16:07]:
> > let's try a new approach.
> ...
> >     my $metatags = q{};
> 
> At this I am stumped.  
> 
> $metatags is a scalar variable; the name is plural, because (as is
> apparent the concatenation assignment operator below) it is to contain
> all the metatags to be relocated, with the newline character as the
> delimiter.  

Good.

> 
> q appears to be a quoting operator, with delimiters { and } .

q is a generalized quote operator. It is followed by a delimiter that
marks the ends of the strings. It's especially useful with paired
delimiters like {} and <>.


> So, in this line of code, it appears that metatags is declared and is
> initialized to the null string.

Agreed.

> I am puzzled as to why it is necessary to initialize the variable to
> the null string, unless the concatenation operator fails when
> attempting to concatenate a string to an undefined scalar.  

It doesn't fail, but the first time gives a warning. This also helps to
document (for the next guy to read it) that we intend this to be a
string and not something else.

> I also am puzzled as to why the curly braces are used as delimiters
> for the null string.  

This I got from the book "Perl Best Practices". The expression q{} is a
bit more visually distinct than '' or "" which look different for
different fonts. In some cases, '' looks more like a double-quote and
can therefore be confusing. Other than that, q{} is identical to ''.

> Finally, I am curious as to why it would not be sufficient merely to
> write:
> 
>     my $metatags = ''

It would be sufficient. It's just a style thing.

G. Wade
-- 
As a software development model, Anarchy does not scale well.
                                                       -- Dave Welch


More information about the Houston mailing list