#!/usr/bin/perl
$_='OTcommailDngATghiliaguans';
1 while s/(.{5})(.{5})?/$_{$2}=$1,$2/e;
print while $_=$_{$_};
It's unusual to put all your text into the posting's subject. It is
possible to ask your question in the posting's body next time? ;-)
Nevertheless, "you" are looking for the first two parts of $_, each 5
chars long. With »$_{$2}=$1« these two parts becomes a key-value-pair in
the hash »%_«. Then you substitutes these two parts with the second one,
i.e. you simply deletes the first 5 chars of $_. That's all your loop is
doing, but successively until your string $_ is shorter than 5 chars. In
your example above this first while loop will give you the hash
%_ = (
'mailD' => 'OTcom',
'ngATg' => 'mailD',
'hilia' => 'ngATg',
'guans' => 'hilia'
'' => 'guans'
);
Now, the string $_ is empty. The second while loop takes the element $_
of %_ and assigns its value to $_ again. So its first pass gets $_{''}
so that $_ contains 'guans' afterwards. print() without params will
print out the content of $_. The next pass is looking for the hash
element 'guans', so it returns 'hilia', etc. Hence, the following
strings arrives one after the other your console:
guans
hilia
ngATg
mailD
OTcom
Reading this as one line could be interpreted as a mailaddress. Btw,
next time you could change your code to
$_='OTcommailDngATghiliaguans';
print "\$_{'$2'}='$1' --> \$_ = '$_'\n" while s/(.{5})(.{5})?/$_{$2}=$1,$2/e;
use Data:

umper;
print Dumper(\%_);
print "$_\n" while $_=$_{$_};
__END__
to figure out by yourself what happens. ;-)
regards,
fabian