Howdy, Stranger!

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

Categories

naming variables..

FirestormFirestorm Member Posts: 162
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

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

  • FirestormFirestorm Member Posts: 162
    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
    ;-)

  • heeroyuyheeroyuy Member Posts: 125
    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]

  • Andre YoungAndre Young USAMember Posts: 0

    _____ ( http://forcoder.org ) free video tutorials and ebooks about < Java PHP C# Visual Basic MATLAB Swift Objective-C R Delphi Perl Visual Basic .NET C++ Go Ruby JavaScript Scratch Python PL/SQL Assembly C Scala Hack Awk FoxPro Clojure Logo Scheme Kotlin F# Crystal Erlang Transact-SQL Fortran Prolog LabVIEW Rust COBOL ABAP Apex Dart Bash Ada VBScript Lisp Lua Alice SAS D Julia ML /> ___

Sign In or Register to comment.