Sponsored Content
Top Forums Shell Programming and Scripting PERL: How do i print an associative matrix? Post 302137914 by foo.bar on Thursday 27th of September 2007 01:12:57 PM
Old 09-27-2007
Bug PERL: How do i print an associative matrix?

Hello guys,

I have in PERL an associative 2-dimensional array, called matrix. The array (actually the matrix) is made up like this
Code:
matrix[a][c] = x;
matrix[a][d] = y;
matrix[b][c] = w;
matrix[b][d] = z;
...

but the names a, b, c, d are set just at runtime.

The question is: how can i get all the keys of the matrix (i.e. a, b, c, d) and print the all matrix?

Thank you very much for your help!

Sergio
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl: Sorting an associative array

Hi, When using sort on an associative array: foreach $key (sort(keys(%opalfabet))){ $value = $opalfabet{$key}; $result .= $value; } How does it handle double values? It seems to me that it removes them, is that true? If so, is there a way to get... (2 Replies)
Discussion started by: tine
2 Replies

2. Shell Programming and Scripting

PERL: How do I get both sizes of a matrix?

Hi everybody, I have a matrix called @matrix dinamically built in PERL, so I don't know its exact sizes. It is a 2-dimensional matrix, so its elements are for example: $matrix $matrix $matrix $matrix $matrix etc... I know i can get the number of the rows of the matrix with the... (2 Replies)
Discussion started by: foo.bar
2 Replies

3. Shell Programming and Scripting

Perl- matrix problem

A C G T - A 5 -4 -4 -4 -5 C -4 5 -4 -4 -5 G -4 -4 5 -4 -5 T -4 -4 -4 5 -5 - -5 -5 -5 -5 0 So lets say I have a matrix which looks something like (above). Its basically a scoring matrix. the numbers are... (2 Replies)
Discussion started by: aj05
2 Replies

4. Shell Programming and Scripting

Invert Matrix of Data - Perl

I have columnar data in arrays perl, Example - @a = (1,2,3); @array1 = (A,B,C); @array2 = (D,E,F); @array3 = (I,R,T); I want the data to be formatted and printed as 1 A D I 2 B E F 3 C F T and so on... (8 Replies)
Discussion started by: dinjo_jo
8 Replies

5. Shell Programming and Scripting

BASH: print matrix from single array

I am creating a report in groff and need to format data from a file into a table cell. Sample data: dador,173323,bpt,jsp,39030013338878,1 dador,173323,brew,jsp,39030013338860,1 dador,173323,brew,jsp,39030013339447,1 dador,173323,brew,jsp,39030013339538,1 I would like to build a table... (12 Replies)
Discussion started by: Bubnoff
12 Replies

6. Programming

Matrix addition - Perl - PDL

Hi All, I have a question. I need to add 3 matrices of size 2000 x 2000. (i.e) 2000 rows and 2000 columns using Perl::PDL module. I used the following perl script #!/usr/bin/perl -w use strict; use warnings; use PDL; use PDL::Matrix; if ( @ARGV != 3 ) { die 'Two matrix files are... (1 Reply)
Discussion started by: Fredrick
1 Replies

7. Shell Programming and Scripting

Perl- creating a matrix from a 3 column file

Dear all, I'm new in perl scripting and I'm trying to creating a matrix from a 3 column file sorting data in a particular manner. In the final matrix I need to have the first column "IDs" on the header of the columns and the second column values on the header of each row. And the value fo the... (2 Replies)
Discussion started by: gabrysfe
2 Replies

8. Shell Programming and Scripting

Randomization a matrix - perl / Shell

Hello all, I have a tricky question! (at least for me it is!). I'll try to explain it carefully here. Hope you can help me solving the whole or even parts of it! Here it is: I have a big input 0\1 table as a very simplified one is shown below: (The last row and column are the sum and... (0 Replies)
Discussion started by: @man
0 Replies

9. Shell Programming and Scripting

How to print median values of matrix -awk?

I use the following script to print the sum and how could I extend this to print medians instead? thanks name s1 s2 s3 s4 g1 2 8 6 5 g1 5 7 9 9 g1 6 7 8 9 g2 8 8 8 8 g2 7 7 7 7 g2 10 10 10 10 g3 3 12 1 24 g3 5 5 24 48 g3 12 3 12 12 g3 2 3 3 3 output name s1 s2 s3 s4 g1 5 7 8 9... (5 Replies)
Discussion started by: quincyjones
5 Replies
GLMATRIXMODE(3G)														  GLMATRIXMODE(3G)

NAME
glMatrixMode - specify which matrix is the current matrix C SPECIFICATION
void glMatrixMode( GLenum mode ) PARAMETERS
mode Specifies which matrix stack is the target for subsequent matrix operations. Three values are accepted: GL_MODELVIEW, GL_PROJECTION, and GL_TEXTURE. The initial value is GL_MODELVIEW. Additionally, if the GL_ARB_imaging extension is supported, GL_COLOR is also accepted. DESCRIPTION
glMatrixMode sets the current matrix mode. mode can assume one of four values: GL_MODELVIEW Applies subsequent matrix operations to the modelview matrix stack. GL_PROJECTION Applies subsequent matrix operations to the projection matrix stack. GL_TEXTURE Applies subsequent matrix operations to the texture matrix stack. GL_COLOR Applies subsequent matrix operations to the color matrix stack. To find out which matrix stack is currently the target of all matrix operations, call glGet with argument GL_MATRIX_MODE. The initial value is GL_MODELVIEW. ERRORS
GL_INVALID_ENUM is generated if mode is not an accepted value. GL_INVALID_OPERATION is generated if glMatrixMode is executed between the execution of glBegin and the corresponding execution of glEnd. ASSOCIATED GETS
glGet with argument GL_MATRIX_MODE SEE ALSO
glLoadMatrix, glPushMatrix GLMATRIXMODE(3G)
All times are GMT -4. The time now is 04:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy