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

Re: comparing array values or?

by AgentM (Curate)
on Mar 14, 2001 at 02:19 UTC ( [id://64237]=note: print w/replies, xml ) Need Help??


in reply to comparing array values or?

Before you start beating yourself up with regexes and splits, try DBD::CSV. It allows you to use SQL queries to retrieve the data for an easier time data-munging. After you retrieve the data sets, comparing them is trivial.
AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.

Replies are listed 'Best First'.
Re: Re: comparing array values or?
by Anonymous Monk on Mar 14, 2001 at 02:21 UTC
    For now we're only using flat files until we build a database. At this point I have no choice but to use flat files. That's why I'm doing it this way.

      Please consider AgentM's suggestion again -- DBD::CSV (and also, DBD::RAM) allow you to treat CSV files (and other formats) as a database -- and later when you do move to a real database you'll be able to move the scripts with very little effort as well.

        Well, we don't have those modules installed, otherwise I'd be happy to use them :). So let me ask this, how do I create an array of dynamically named arrays?

        I'll assume:

        @array = @array1,@array2,@array3, etc. Each array in @array is dynamically named.


        Here's the code I've got to get started. It's not much, but hey...we got to start somewhere with it.
        open(FILE, "data.txt"); #opens data.txt in read-mode while(<FILE>){ #reads line by line from FILE which i +s the filehandle for data.txt chomp; # print join(':', split(/,/,$_)); # print "\n"; @data = split(/,/,$_); } close FILE; #close the file.

        So, am I being lame or what?
        Sure, but the problem is none of our servers have those modules installed, otherwise it'd be a great idea. :(

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-04-26 05:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found