LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-15-2015, 04:47 AM   #1
Zahraa Ayad
LQ Newbie
 
Registered: Dec 2014
Posts: 19

Rep: Reputation: Disabled
Post emptying an associative array in TCL NS-2


I am working with NS2.35 and tcl8.5 and i have a procedure that will be called several times ...
inside this procedure i have an associative array (arr) i want to empty this array each time the procedure is called
i tried to unset the array after entering the procedure like this :

Code:
 foreach idx [array names arr] {
unset arr($idx)
}
and i tried:

Code:
foreach idx [array names arr] {
   set arr($idx) {}
}
but the array is still have the old values and each time the procedure is called the new values is added to the old values!
Can you help me to do this in a right way?
 
Old 11-15-2015, 06:12 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
The following is a general overview, my perception of ns2.

Assume "new function" compiled into tcl8.5 ...
* ns2 will use some basic tcl8 functions. (ns-allinone-2.35/lib/**).
* ns2 is (also) an otcl application: otcl must be recompiled with the new tcl8.5.
And ns-2.35/ recompiled with the new otcl .

The script `install' will do a 'make distclean' in tcl8.5 and ns-2.35.
* Otcl and Tclcl : A manual 'make distclean' is required.


Please also ask here https://stackoverflow.com/questions/tagged/ns2


-
 
  


Reply

Tags
array, ns2, ns2 ns-allinone, tcl, tcl-ns2



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] ksh unset on first element of associative array unsets the whole array luvshines Programming 4 05-29-2015 07:27 AM
associative array in bash divyashree Programming 4 09-22-2014 12:13 PM
[SOLVED] AWK associative array problem rng Linux - General 17 02-12-2014 11:48 PM
[SOLVED] Associative array in bash not unsetting grail Programming 4 04-07-2011 09:11 AM
Sorting through associative array with user input nobody123 Linux - Newbie 3 04-08-2009 01:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration