naming variables..

hi it's me again......

I have an array which I try to name dynamically
that means I have a loop in which there is an scalar $j

and I try to make sth. like: @div_$j = .......
see what I mean?

when $j increases I want further data to be stored in an new array and to get a new array I tryed to add $j to the name of it
(so I have @div_1, @div_2, ...)
[red]BUT[/red]
the way I did it seems wrong!!!!!!
Question:
How do I do it right???????????
Firestorm
fgretz@gmx.de
;-)

Comments

  • Use an eval block. At least that would be what I would do :)
    -----------------------
    [RED]Heero Yuy
    Perl Board Moderator
    Perl Semi-Expert[/RED]

  • What is an eval block???????
    : Use an eval block. At least that would be what I would do :)
    : -----------------------
    : [RED]Heero Yuy
    : Perl Board Moderator
    : Perl Semi-Expert[/RED]
    :
    :

    Firestorm
    fgretz@gmx.de
    ;-)

  • An eval block is a block of code that either catches an exception, or executes the given code. I don't usually have a reason to use one. I'll grab u an example in a while, or jus do a search. It will allow u to put the command to make a new array into a string by simply adding the string together, then execute that string as perl code :) Once again, give me a bit to find this, I am on vacation for the 4th and don't have much time
    -----------------------
    [RED]Heero Yuy
    Perl Board Moderator
    Perl Semi-Expert[/RED]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories