On 05/12/2016 11:00 PM, SSC_perl wrote:
On May 12, 2016, at 7:10 PM, Shawn H Corey wrote:my $holders = join ',', ('?') x @cgi_params;PBP recommends that you put short strings that are all punctuation in q{}, so they will be easier to read. my $holders = join q{,}, (q{?}) x @cgi_params;I realize stuff like this is subjective, and coding styles can be very personal, but this looks cleaner to me: my $holders = join ',' => ('?') x @cgi_params; Since I found the fat comma, I use it all the time now - especially when two commas are so close together. I'm kind of surprised PBP would say that q{} is easier to read in this situation. IMHO, it seems to just adds noise.
i stick to using fat comma ( => ) only for key/value pairs. it has the side effect of quoting a bareword to the left which makes those pairs easier to read. so i never use it just for a comma though i have seen it used like that. this is definitely a matter of taste and i know mine is better than most! :)
as for q{} i stick to using it when there are quote chars in the string. i haven't had trouble reading '' (vs "" vs q{}) as the null string. pick a better font if you have trouble! :) also context (not perl but code in general) should make it easier to know when a null string is being used.
thanx, uri -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
