On 11/1/06, John W. Krahn <[EMAIL PROTECTED]> wrote:


Use a hash:

my %oob = (
    state => 'IL',
    lata  => 732,
    name  => 'SomeName',
    );

If you don't think that you need a hash then be aware that what you are trying
to do is actually using a hash anyways (the %main:: hash.)



John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order.       -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




thanks to all for the replies.  i think i was probably too concise in
my explanation; i'll try to elaborate without going overboard...

the current code goes like this:

&build_oracle_args_ne(FIELD => "ooba_element_host_name", VARIABLE =>
$ne_ooba_element_host_name);
# and several other similar lines of code

sub build_oracle_args_ne
{
        my %options = @_;
        #       $options{FIELD}         comma-separated list of fields to build 
into oracle argument
        #       $options{DB_ARGS}       string of Oracle field comparisons to be
dynamically constructed
        #       $options{VARIABLE}      variable to compare to ORACLE field
        
        #       $oracle_args_oob defined elsewhere in program as a "global" 
variable
        $oracle_args_ne .= ($oracle_args_ne =~ /where/ ? " and " : "where ")
. "upper($options{FIELD}) like '%" . uc($options{VARIABLE}) . "%'" if
$options{VARIABLE} ne "";
}       #       end of  sub build_oracle_args_ne

#####################
the purpose is to dynamically create a list of fields and values (from
a web interface) to compare in an oracle database (it has to be
dynamic due to the need to search any field, as well as the fact that
the person creating the database built 3 tables which store the same
data but with slightly different field structures/sequences -
different problem, just some background).  the result would be
something like

"... where upper(state) like '%IL%' and upper(lata) like '%732%' ..."

for however many fields had been populated in the form.  in the
updated routine, i wanted to pass only the oracle fieldname and create
the variable that held the desired data to build the sql query, not
pass the variable as a second argument, either as a hash or another
scalar.

i'll look at hashes but i don't think that's the best solution for
this.  if someone could, just for arguments sake, tell me how to do
this the "wrong" way, i'd really appreciate it, just for knowing
another alternative, whether i actually do that or not.

thanks again.

joe


--
since this is a gmail account, please verify the mailing list is
included in the reply to addresses

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to