sudeep has asked for the wisdom of the Perl Monks concerning the following question:

hi perlmonks, I wanted to use Set::Scalar in my module actualy I have a symbolics table where it has symbolic name, flag and the sql statement are the columns in the table. Now I have to retrieve the symbolic name and the sql statement. When I execute the sql stmt thru perl I will get the values.
so wat I have to do is I have to store the symbolic name as a key + and the value(s) from the executed sql stmt shud b stored as a value +s. for ex. GLOBAL_SYMBOLIC_NAME = num_rows and SOURCE_SQL = select count(*) from ... and the SQL returns the number 150,000 which is a value.
when Thankyou. </c>

Replies are listed 'Best First'.
Re: using Set::Scalar
by kyle (Abbot) on Feb 19, 2008 at 05:13 UTC

    Looking at Set::Scalar, I don't think it's going to help here, at least not by itself. What it does is give you a way to hold a set of values without associations. In hash terms, it only holds keys, not values.

    For the kind of problem you're describing, I think a tied hash could work well. See perltie for how to make one. You'll probably want to start with Tie::Hash or Tie::StdHash as a base class. You'll override FETCH at the very least.