Hi,

I could use some help with the following problem:

I have this input file that looks like this (after some processing):

%1%MO%1s%.0000%-.0003%.0000%.0003%.0002%.0006%-.0005%.0020%-.0035%.0006
%2%MO%1s%-.0001%-.0021%-.0003%.0018%.0015%.0042%-.0034%.0136%-.0234%.0042
%3%MO%1s%-.0005%-.0085%-.0010%.0071%.0060%.0161%-.0139%.0556%-.0953%.0166
%4%MO%1s%-.0020%-.0341%-.0037%.0280%.0249%.0435%-.0658%.2286%-.3871%.0593
%5%MO%1s%.0182%-.0592%.1039%-.0179%.0960%-.0550%-.4774%.7751%-1.2943%.0993
%6%MO%1s%-.0027%-.0202%.0121%.0205%.0281%-.0688%-.0198%.3710%-.4371%.0543
%7%MO%1s%-.0004%-.0059%.0042%.0057%.0090%-.0206%-.0058%.1229%-.1377%.0221
%8%MO%1s%.0001%-.0010%.0008%.0010%.0017%-.0055%-.0006%.0260%-.0273%.0057
%9%MO%2px%.0000%-.0001%.0000%.0000%-.0001%-.0003%.0001%-.0004%-.0002%.0005

I need to read this input into a multidimensional array. Since there are no real multidimensional arrays in perl I need to use references. The way I thought it would work was like this:

my @input;
my $i = 0;
while(<INFILE>){
  $input[$i] = \split(/%/,$_);
  $i = $i+1;
}

But it doesn't work. The references in $input[$i] all point to a scalar value (the last one of each input line actually).

Does anyone know how I should do it?

Greets,

Kris

--
-----------------------------------------
Kris Gaethofs
Lab for Quantumchemistry
Celestijnenlaan 200F
B-3001 Heverlee (Leuven)
Tel: +32 16 32 78 03 Fax: +32 16 32 79 92
Email: [EMAIL PROTECTED]
-----------------------------------------

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to