Variable number of parameters in perl function
hello,
I hope you can help me a little,
Iām using DBD::mysql.
My regular procedure for query execution is:
______________________________________________________________
my $str= ā?,?,?,,,ā;
$q=$dbh->prepare("INSERT INTO $table VALUES($str)")
or die "Couldn't prepare statement: " . $dbh->errstr;
$q->execute($args1[0],$args1[1],$args1[2],ā¦)
or die "Couldn't execute statement: " . $q->errstr;
________________________________________________________________
THE PROBLEM:
If I want to change the number of arguments sent to execute(), I must change the source code.
I would like to be able to change it on run-time with something like:
______________________________________________________________
$q->execute(f(@args))
or die "Couldn't execute statement: " . $q->errstr;
_____________________________________________________________
where f() formats the input to the function, and $#args can be in variable size.
Is there any perl function that does it ?
thanks
A
Subject
Written By
Posted
Variable number of parameters in perl function
December 17, 2007 01:43PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.