Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Split file output into array of arrays

by spickles (Scribe)
on Feb 16, 2010 at 23:49 UTC ( [id://823578]=note: print w/replies, xml ) Need Help??


in reply to Re: Split file output into array of arrays
in thread Split file output into array of arrays

Thank you!! So to access each array, it would be

$records[0][0]<br/> $records[0][1]<br/> $records[0][2]<br/> $records[1][0]<br/> $records[1][1]<br/> $records[1][2]<br/> . . .

The reason I ask is that each array created and pushed to @records is not explicitly named.

Regards,
Scott

Replies are listed 'Best First'.
Re^3: Split file output into array of arrays
by GrandFather (Saint) on Feb 17, 2010 at 00:02 UTC

    You asked for an array of arrays. If you wanted an array of hashes or something else you should have said so. Maybe your sub that performs the matching can sort it out? Of course I can't see that code so it's not clear where or what your current problem is.


    True laziness is hard work

      GrandFather -

      No worries there. I asked for an array of arrays, and that's what you gave me. I was just wanting to clarify that the method of accessing them would be as I posted earlier

      $records[firstarray][firstrecord] $records[secondarray][firstrecord] . .

      I'll work on sorting it out and post back if I have problems.

      Regards,
      Scott

        That looks backwards to me. In fact I'd code access as:

        for my $record (@records) { for my $line (@$record) { .... } }

        $records[firstrecord][firstarray] could also be written $records[firstrecord]->[firstarray] to emphasise that @records is an array of references to arrays. Keep in mind that Perl only allows scalar values for arrays and hashes, but a reference to something (like and array) is a scalar.


        True laziness is hard work

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (7)
As of 2024-04-25 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found