Hi,

What framework are you all using for database development? When tracking this 
thread back to the original message, I thought, "Nice syntax." I am overall new 
to Perl, but am learning it for ETL at work.

Thanks,
Mike

-----Original Message-----
From: Shawn H Corey [mailto:shawnhco...@gmail.com] 
Sent: Friday, May 13, 2016 7:16 AM
To: beginners@perl.org
Subject: Re: This is one of the things ...

On Fri, 13 May 2016 00:11:57 -0400
Uri Guttman <u...@stemsystems.com> wrote:

> 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.

Another method is to use `constant` since it creates constant subs which perl 
replaces with the literal.

$ cat quotes.pl
#!/usr/bin/env perl

use constant {
    qSPACE    => q{ },
    qCOMMA    => q{,},
    qQUESTION => q{?},
};

my $holders = join qCOMMA, (qQUESTION) x @cgi_params;

$ perl -MO=Deparse ./quotes.pl
use constant ({'qSPACE', ' ', 'qCOMMA', ',', 'qQUESTION', '?'}); my $holders = 
join(',', ('?') x @cgi_params); ./quotes.pl syntax OK


Notice in the join that qCOMMA and qQUESTION were replaced with the
literal.


-- 
Don't stop where the ink does.
        Shawn

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/





--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to