Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re: Extracting array of hashes from data

by nysus (Parson)
on Jun 10, 2001 at 01:44 UTC ( [id://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;

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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://87240]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-25 02:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found