On Wed, 3 Apr 2002, Darren Rook wrote:
> I'm trying to push data into for use in a nested loop, but it's not being
> pushed properly.
> Can anyone help? Here's some psuedo code:
>
> my ( %show_data );
you declare %show_data here
> my ( @shows, @dates_data );
> while (data from DB) {
> if ( done_with_line ) {
> $show_data{"DO_STATIC"} = $static;
> $show_data{"date"} = &text_date(
> &date_longsql_to_perl($lastdate) );
> $show_data{"datelink"} =
> &date_longsql_to_perl($lastdate);
> $show_data{"DATES-DATA"} = \@dates_data;
>
> push @shows, \%show_data;
and you push a reference to it here.
> %show_data = ();
then you reinitialise it to ().
Question (and answering it will give you your answer).
when you do %show_data=(), what happens?
does it
- create a new hash stored at a new memory location?
- assign an empty hash to the same hash stored at the same memory
location?
would \%show_data be the same or different?
if they it is the same, then would changing %show_data at one place
change its value at all places where it is referenced?
Philip
PS: If you don't like my style, tell me. This is an experiment in
constructivism.
--
No more blah, blah, blah!
-- Kirk, "Miri", stardate 2713.6
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]