http://qs1969.pair.com?node_id=87240


in reply to Re: Extracting array of hashes from data
in thread Extracting array of hashes from data

I'm still running into a problem using push @{ $alldata{$key} }, \%temphash;

For instance, try: print "$alldata{PROTSIM}[2]{PCT}\n"; at the end of the file. You'll get an Use of uninitialized value at test.pl line 24, <DATA> chunk 35. error. What's strange is that: print "$alldata{PROTSIM}[2]{ORG}\n"; is AOK.

Anyone have any ideas?

I have not read perldsc but I certainly will. Looks useful.

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar";
$nysus = $PM . $MCF;

Replies are listed 'Best First'.
Re: Re: Re: Extracting array of hashes from data
by srawls (Friar) on Jun 10, 2001 at 02:06 UTC
    Took me a sec, but I got it. In your data, sometimes you have spaces after the ;, and sometimes you don't. After each of your splits (or just the split/;/'s) add  \s* as in:
    my @splitvalue = split /;\s*/, $value;

    The 15 year old, freshman programmer,
    Stephen Rawls