$theText = "abc def ghi"; print "this value for $theText == " , ghash($theText), "\n"; $theText = "acb def ghi"; print "this value for $theText == " , ghash($theText), "\n"; ##################### sub ghash() { my ($str) = @_; my $y = length($str); my $ret = 0; for(my $i = 0; $i < $y; ) { $ret += ord( substr($str, $i,1)) * (++$i); } return $ret; }