If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Perl and the DBI > Newbie question : how to print this hash ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-20-07, 17:34
Serg Serg is offline
Registered User
 
Join Date: Feb 2004
Posts: 52
Newbie question : how to print this hash ?

Hi all,

I have a code which uses a hash defined like this :

$matrix[$x][$y][$z]

where x, y and z run from 0 to N (each).
Does someone know how to print all elements of "MATRIX" in a single
line (separated by a single space and all numbers formatted by %15.6F)
but looping over indexes z, y and x, respectively ?

In Fortran this is trivial :

WRITE(*,'(8000000E15.6)') (((matrix(x,y,z),x=0,N),y=0,N),z=0,N)

since the outer loop is Z, followed by Y and X.

I can't figure it out how to do the same in Perl.

Thank you in advance for any insights !

S.

Last edited by Serg; 02-20-07 at 18:03.
Reply With Quote
  #2 (permalink)  
Old 02-20-07, 19:36
Serg Serg is offline
Registered User
 
Join Date: Feb 2004
Posts: 52
Problem solved.

(it was not a hash but a multi dimensional array)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On