Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: Extracting array of hashes from data

by nysus (Deacon)
on Jun 10, 2001 at 01:44 UTC ( #87240=note: print w/ replies, xml ) Need Help??


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;


Comment on Re: Re: Extracting array of hashes from data
Select or Download Code
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://87240]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2015-08-01 01:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (285 votes), past polls