Re: Combining a variable with a counter?



Christoph Hörterer wrote:
> in my script, I got many similar variables
> task1 task2 task3 task4 ....
>
> I'd like to address them in a loop with something like
>
> $task$i
>
And then there's the method that most people always seem to forget:

for {set i 1} {$i <= 4} {incr i} {
upvar 0 task$i task
puts $task
}

But this is just for completeness. Go with arrays unless you have a
real good reason not to.

Schelte.
--
set Reply-To [string map {nospam schelte} $header(From)]
.



Relevant Pages

  • Has anyone tried scripting IPFX (Outlook addon)
    ... script to dial a number. ... Loop ... Prev by Date: ...
    (microsoft.public.scripting.vbscript)
  • getting filename in <>
    ... I have a script that reads all input from the files specified in ... Inside the loop can I get the filename of the file from which is ... Prev by Date: ...
    (perl.beginners)
  • Looping through the users table
    ... I'm new to Oracle and I would like to find a way to create a script that ... will loop through a list of users (the output of a select query from the ... Prev by Date: ...
    (comp.databases.oracle.misc)
  • How can I speed up this code?
    ... I am running the following code as part of a script, ... code can take up to an hour for Matlab to calculate. ... somehow to remove the for loop? ... Prev by Date: ...
    (comp.soft-sys.matlab)
  • lk-changelog.pl 0.325
    ... This script is used by Linus and Marcelo to rearrange and reformat BK ... +'christoph:lameter.com' => 'Christoph Lameter', ... 'hawkes:oss.sgi.com' => 'John Hawkes', ... 'lethal:unusual.internal.linux-sh.org' => 'Paul Mundt', ...
    (Linux-Kernel)