my $transref_chksql= <<~ 'SQLSTR'; SELECT CASE WHEN EXISTS (SELECT * FROM pg_class WHERE relkind = 'S' AND relname= 'encode_transref_seqm') THEN 'transref_seq_add' ELSE 'ignore' END SQLSTR my $transseqchk->{transchk}= ($dbh->selectrow_array($transref_chksql))[0]; my %actionsw; $actionsw{transref_seq_add}->{cmd}=sub{ (my $encode_transref_seqmsql= <<~ 'SQLSTR'); CREATE SEQUENCE IF NOT EXISTS transref_seqm Start 0 minvalue 0 OWNED BY encodes.fileid SQLSTR $dbh->do($encode_transref_seqmsql); }; if ($actionsw{$transseqchk->{transchk}}->{cmd}){ &{$actionsw{$transseqchk->{transchk}}->{cmd}}; }