in reply to Re: New to Perl
in thread New to Perl

%current_case && push @cases, \%current_case; %current_case=();

Try it with a data set with more than one case.

Replies are listed 'Best First'.
Re^3: New to Perl
by Random_Walk (Prior) on Jan 21, 2005 at 01:02 UTC

    Hi Chromatic

    Thanks for reading and thinking about my code, its a fair cop, I just reset the hash rather than grabing a new one, DOH ! Sadly its 00:58 here, this evening I have enjoyed good company, a delicious Rioja and I got a 9am meeting, so no more coding till the morning.

    G'night,
    R.

    Pereant, qui ante nos nostra dixerunt!
Re^3: New to Perl
by Random_Walk (Prior) on Jan 21, 2005 at 14:22 UTC

    OK I found a couple of fixes, either make %current_case a package global with our then push a new ref to an empty hash into its typglob *current_case={}; or make current case a $scalar, store a ref to an anon hash in it $current_case={}; and replace all instances of %current_case{whatever} with $current_case->{whatever}. I guess the latter is the prefered solution

    Cheers,
    R.

    Pereant, qui ante nos nostra dixerunt!