On 01.05.2016 15:36, James E Keenan wrote:
> 
> Thanks; that worked:
> 
> #####
> cat dbiish_connect_dynamic_3.pl6
> #!/usr/bin/env perl6
> use DBIish;
> 
> my $db = 'hierarchy';
> my $dbh = DBIish.connect("Pg", :database($db));

Another nice little language feature is that you can reuse the name of
variable when it coincides with the name of the named parameter.

So :database($database) just becomes :$database.

Which today often influences how I name my variables:

my $database = 'hierarchy';
my $dbh = DBIish.connect('Pg', :$database);

(and it's a feature I miss surprisingly often when back in perl 5 or
python land).

Cheers,
Moritz

Reply via email to