View Single Post
Old Apr 15th, 2005, 8:04 AM   #5
spydoor
Programmer
 
Join Date: Feb 2005
Posts: 64
Rep Power: 4 spydoor is on a distinguished road
Yes, because 'world' is there twice, it loops infinitely.
You need to understand what a hash (associative array) is, to really see what is going on.

For this example it's functioning like a lookup table.

$_{KEY} = VALUE

$_{'peace'}='world'
$_{'walks'}='peace'
$_{'away?'}='walks'
$_{'world'}='away?'
$_{''}='world'

while $_ = $_{$_}; # loop while I get a VALUE; assign KEY=VALUE after each iteration

KEY = ''        VALUE = 'world'
KEY = 'world'   VALUE = 'away?'
KEY = 'away?'   VALUE = 'walks'
KEY = 'walks'   VALUE = 'peace'
KEY = 'peace'   VALUE = 'world'
KEY = 'world'   VALUE = 'away?'      #infinite looping begins
.
.
.
spydoor is offline   Reply With Quote