Forum Discussion
agentile_2106
Nimbostratus
Feb 01, 2011Array get and foreach statement HELP!
Hi Guys,
i'm going crazy with a simple array operation in a foreach statement. If i run:
when HTTP_REQUEST {
array unset colorcount
array set colorcount {
red 1
green 5
blue 4
white 9 }
foreach {color count} [array get colorcount] { log local0. "Color: $color Count: $count"}
i expect a reply "Color: red Count:1"
But on my logs i've got:
Feb 1 16:02:51 local/tmm info tmm[23012]: Rule IRULE-SMS-Sender-Rate : Color: blue Count: blue
Feb 1 16:02:51 local/tmm info tmm[23012]: Rule IRULE-SMS-Sender-Rate : Color: 4 Count: 4
Feb 1 16:02:51 local/tmm info tmm[23012]: Rule IRULE-SMS-Sender-Rate : Color: white Count: white
Feb 1 16:02:51 local/tmm info tmm[23012]: Rule IRULE-SMS-Sender-Rate : Color: 9 Count: 9
i've done this simple test because i'm wrinting an irule and i've recognized that the foreach statement on arrays seems not working!
Please, help
Regards
Tony
2 Replies
- hoolio
Cirrostratus
Hi Tony,
See the post below for details on this bug:
Unexpected result from foreach loop on 10.2
http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/afv/topic/aft/1172718/aff/5/showtab/groupforums/Default.aspx
Aaron - agentile_2106
Nimbostratus
Thanks Aaron,
i've found the post yesterday night.... Is there any workaround as far as you know?
it is a foreach statement issue or an array issue?
i have to implement an irule very similar to this one
http://devcentral.f5.com/wiki/default.aspx/iRules/RateLimit_HTTPRequest.html
i was thinking about "table commands" instead of the use of arrays.
what do you think?
Thanks for your help!
Regards
Antonio
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
