Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Reading data from mySQL into hashes and manipulation of hashes

by simeon2000 (Monk)
on Aug 30, 2002 at 12:46 UTC ( [id://194087]=note: print w/replies, xml ) Need Help??


in reply to Reading data from mySQL into hashes and manipulation of hashes

For #1 you could shorten that "result" hash code by using array slices:

my %results = (); @results{ @row[5..10] } = @row[11..16];
You also don't need to quote your "$row[xyz]" declarations.

I'm not sure what to tell you about those totals though. I can tell you that this is a very strange way to design a database... having "column names" stored in columns. I would suggest a rewrite and then you can use fetchrow_hashref a lot easier. But that's just me.

--
perl -e "print qq/just another perl hacker who doesn't grok japh\n/"
simeon2000|http://holdren.net/

Log In?
Username:
Password:

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

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

    No recent polls found