Hello everybody ,
I have a problem with arrays ...
I need to get some data from files in some directories .
The names of the dirs are something like 12.12344 or 23.34441.
Some contains one , some 2 or 3 files .
I'd like to get data from those dirs recursively ... but dunno how .
I've tried something like :
@DIR=("12.12344","23.34441");
@12.12344=("height","width");
@23.34441=("height");
and then reading with 2 nested foreach :
foreach $directory (@DIR) {
foreach $element ($[@directory]){ <- this is wrong I know , but how can i do something like this ??
1) I can't use the "." in the name of the array
2) Dunno how to use the variable name as the name of the array ...
I tried even with something like :
%DIR=("12.12344","height",
"23.34441","height",
"12.12344","width")
and using :
while (($directory, $element) = each(%DIR)){
but isn't working either , seems because the keys are repeated .
Maybe it's a stupid problem , I know , but this is my first
try in Perl
( Yes , I' m a total noob
)
Someone can help ?
Thx in advance
David
I have a problem with arrays ...
I need to get some data from files in some directories .
The names of the dirs are something like 12.12344 or 23.34441.
Some contains one , some 2 or 3 files .
I'd like to get data from those dirs recursively ... but dunno how .
I've tried something like :
@DIR=("12.12344","23.34441");
@12.12344=("height","width");
@23.34441=("height");
and then reading with 2 nested foreach :
foreach $directory (@DIR) {
foreach $element ($[@directory]){ <- this is wrong I know , but how can i do something like this ??
1) I can't use the "." in the name of the array
2) Dunno how to use the variable name as the name of the array ...
I tried even with something like :
%DIR=("12.12344","height",
"23.34441","height",
"12.12344","width")
and using :
while (($directory, $element) = each(%DIR)){
but isn't working either , seems because the keys are repeated .
Maybe it's a stupid problem , I know , but this is my first
try in Perl
Someone can help ?
Thx in advance
David