map { s/Z/\x24/g; eval() } map { m/(.*)/ } q{THE PROGRAM}; ## The statements in order of execution: q{THE PROGRAM} # The string containing the program, all $ replaced with Z map{m/(.*)/} # Put the string in $_, otherwise the regex fails # with "Can't modify constant item in substitution" map { # Using the variable $_ s/Z/\x24/g; # Replace all 'Z' with '$' (to replace the missing sigils) eval() # and do a string eval } #### map { $\.=chr(96+( $b | $_ >> 4 & 63 || 0xc0 ) & 255); $b =$_ <<8>>4 & 0xf0 } map { ord } map { utf8::decode($_); m/([^Â])/g } qq(¡Q1@\0\cPàñ@\xc2\x80Q \cA\0Q À\0\xc2\x80\cP0°Q ); $\.=qq[,\n], print'' #### $\.=qq[,\n], print '' #### Char Ord Bits -------------------- \0 0000 0000 j 106 0110 1010 u 117 0111 0101 Discard the first 4 bits of \0, leaves: 0000 0110 -> 6 -> \cF 1010 0111 -> 167 -> \xA7 0101 .... #### space 32 01100000 a 97 01100001 to u 117 01110101 #### (each separate char) # The string split into a list of chars map{ ord } # The ordinal value of the char in $_ map{ # uses $b to buffer the 4 bits from the previous # character $\ .= # Append to $\... chr( # the character with ordinal value of 96+( # the 96 ( 01100000 ) that was removed plus $b # the buffered bits from the previous char # stored in $b's 4 high bits (11110000) | # Fill the four low bits with $_ >> 4 & 63 # the four high bits from the current character || 0xc0 # If zero (ie space), use 192 (11000000) instead ) &255 # for space, 192 + 96 = 288 (100100000), so remove # the 9th bit which leaves 32 (00100000) ); $b = # buffer the 4 low bits of $_ as the 4 high bits # $b by: $_<<8>>4 # equiv of $_ << 4 (ie shift $_ left by 4) & 0xf0 # and zero all but bits 5-8 } #### Char Perl/Latin-1 UTF-8 -------------------------- é A9 C3 A9 ° B0 C2 B0 #### map{ utf8::decode($_); # Try to decode the string from UTF8 # If it fails, it leaves  (\xC2) characters m/([^Â])/g # So match each character except for  } qq(The string) #### ¡Q1@\0\cPàñ@\xc2\x80Q \cA\0Q À\0\xc2\x80\cP0°Q