H
Hemant Shah
Folks,
How do I dynamically generate function and then execute the function?
I have a perl script that is used to drop/create/update database tables.
The script has drop/create/update functions for each table, and I
have if statements to call appropriate functions:
Example:
if ($TableName eq "TRAC")
{
CreateTRACTable();
}
elsif ($TableName eq "TRCO")
{
CreateTRCOTable();
}
and so on. I have similar if statements for drop and update.
Instead of having bunch of if statements, I can put the table
names in a hash and call:
if ($Action eq "Create")
{
Create${TableName}Table():
}
elsif ($Action eq "Drop")
{
Drop${TableName}Table():
}
and so on.
How do I do this?
Thanks.
--
Hemant Shah /"\ ASCII ribbon campaign
E-mail: (e-mail address removed) \ / ---------------------
X against HTML mail
TO REPLY, REMOVE NoJunkMail / \ and postings
FROM MY E-MAIL ADDRESS.
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind, Above opinions are mine only.
it's backed up on tape somewhere. Others can have their own.
How do I dynamically generate function and then execute the function?
I have a perl script that is used to drop/create/update database tables.
The script has drop/create/update functions for each table, and I
have if statements to call appropriate functions:
Example:
if ($TableName eq "TRAC")
{
CreateTRACTable();
}
elsif ($TableName eq "TRCO")
{
CreateTRCOTable();
}
and so on. I have similar if statements for drop and update.
Instead of having bunch of if statements, I can put the table
names in a hash and call:
if ($Action eq "Create")
{
Create${TableName}Table():
}
elsif ($Action eq "Drop")
{
Drop${TableName}Table():
}
and so on.
How do I do this?
Thanks.
--
Hemant Shah /"\ ASCII ribbon campaign
E-mail: (e-mail address removed) \ / ---------------------
X against HTML mail
TO REPLY, REMOVE NoJunkMail / \ and postings
FROM MY E-MAIL ADDRESS.
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind, Above opinions are mine only.
it's backed up on tape somewhere. Others can have their own.