View Single Post
Old Apr 15th, 2005, 1:27 AM   #4
lunarny
Newbie
 
Join Date: Apr 2005
Posts: 3
Rep Power: 0 lunarny is on a distinguished road
Thank you very much.

"$2 causes the value of $2 to get trucated from $_ after each loop..... not sure why ?"

s/(.{5})(.{5})?/$_{$2}=$1,$2/e;
my opinion, the sentence above has two function:
s/(.{5})(.{5})?/$2/; (substitute $1$2 with $2)
$_{$2}=$1,(input $1 into hash)
I think the role of "/e" is to disreagard all components before "," when substitution begins. so for
s/(.{5})(.{5})(.{5})?/$_{$2}=$1,$2,$3/e;
will substitute $1$2$3 with $3.

"so in other words it's a very cryptic way to print the string out backwards 5 character chunks at a time, but you probably knew that part"

I don't know it before. Your help is really valuable.
Thanks.
I don't know hash before.
An interesting thing is that if you use "$_=worldpeacewalksaway?world" The script will go on and on.
I don't know if it is because we have the same two keys "world" here for hash.
Have you heard of it? thanks!
lunarny is offline   Reply With Quote