Hi Nora,

On Tuesday 02 November 2010 10:38:03 HACKER Nora wrote:
> Hi Shlomi,
> 
> > Instead of calling your variables $sql_$kurz and $sth_$kurz, etc. put
> 
> them in
> 
> > %umg hash or a different one - possibly referenced by keys of a hash
> > reference or slots of an object:
> > 
> > {{{
> > my $lang_sql = $runtime_data{$lang} = NoraSqlObject->new;
> > 
> > $lang_sql->sql(
> > 
> >     "select * from umgebungen_vw where beschreibung like \'$lang%\'"
> > 
> > );
> > $lang_sql->sth($dbh->prepare($lang_sql->sql));
> > }}}
> > 
> > In your case, I don't see you are using the various $kurz variables
> > outside the
> > loop so I don't see why you need to associate them with the
> > varvarname.
> 
> I'm really sorry but since I am quite new to Perl I just don't
> understand what you mean. :-(

Sucks.

> 
> In your opinion, what should the hash mentioned in your first paragraph
> contain?

It should contain data specific to every $lang/$kurz pair (whatever $kurz is - 
I don't speak German, and one should use English identifiers in one's code.). 
The keys would be either $lang or $kurz (whatever you prefer to iterate on) 
and you would populate the values of the hash (which could be a hash 
reference, but should preferably be an object of a certain class) with the 
variables specific to the $lang/$kurz pair like you do now with varvarname.

> 
> And where does NoraSqlObject come from?
> 

"NoraSqlObject" is the class name of the objects you would use as the values 
of the hash that holds the data for all $lang/$kurz. It could be called 
differently. To learn more about objects see:

http://perl-begin.org/topics/object-oriented/

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
http://www.shlomifish.org/humour/ways_to_do_it.html

<rindolf> She's a hot chick. But she smokes.
<go|dfish> She can smoke as long as she's smokin'.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to