"be consistent" PerlMonks

### The Power Of Regular Expression

by liz (Monsignor)
 on Oct 01, 2003 at 23:16 UTC Need Help??

```%_=(62,20,38,1,35,50,33,2,60,10,37,5);s:#*>*<*%*!*&*
*:\$;=30;\$;+=\$_{+ord}for split'',\$&;chr\$;:eg for\$_=q:
>>!!#><%&&>>>>%>><<<<%&!#<%!#><>>><<&#<<<!&&&&#<<!&&
>>>%%&>><<%%%%&&&&!>><#>&>>><<!!>>>%%%&&&!><<<<<&&&&
>><<%!>><%%%&&&&#>%&&>>><&>>>>&&&&:;print;{{{[()]}}}

Replies are listed 'Best First'.
Re: The Power Of Regular Expression
by idsfa (Vicar) on Oct 02, 2003 at 03:16 UTC

s///eg and the hash table disguised as an array, plus basic bamboozling with difficult characters. In a more transparent form ...

```
%_=(62 => 20,
38 => 1,
35 => 50,
33 => 2,
60 => 10,
37 => 5);

#  Match each chunk of optional characters in a specific order
#  Look up the ASCII values of each char in the chunk in the hash
#  Add the hash values plus a starting value of 30
#  Replace the chunk with the character whose ASCII you just added up

# (Pattern modified to add \s* so that chunks could be
#  formatted prettily)

s:#*>*<*%*!*&*\n*\s*:
\$;=30;  \$;+=\$_{+ord}  for split'',\$&;  chr\$;  :eg

for

\$_=q:>>!!
#><%&&
>>>>%
>><<<<%&
!
#<%!
#><
>>><<&
#<<<!&&&&
#<<!&&
>>>%%&
>><<%%%%&&&&
!
>><
#>&
>>><<!!
>>>%%%&&&
!
><<<<<&&&&
>><<%!
>><%%%&&&&
#>%&&
>>><&
>>>>&&&&:;
print;

PS Did you get the idea for hiding the newline from your critique of my JAPH?

Remember, when you stare long into the abyss, you could have been home eating ice cream.

Create A New User
Node Status?
node history
Node Type: obfuscated [id://295780]
help
Chatterbox?
 [erix]: my objection to sigs is just that they take screen space. ( Some monks would have *several* slogans underneath a 1-liner reply ) [Discipulus]: a solution would be disabiltate sig as default and let users to show them

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2017-06-22 12:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
How many monitors do you use while coding?

Results (519 votes). Check out past polls.