Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: My Perl Obfuscator

by jwkrahn (Abbot)
on Jan 12, 2024 at 03:27 UTC ( [id://11156907]=note: print w/replies, xml ) Need Help??

in reply to My Perl Obfuscator

sub ReplaceVarNameInsideString ... # Detect special 2-letter variable names such as $' or $[ or $3 if ($TEST =~ m/^(\$[0-9\<\>\(\)!?~=:;,.`'%@&#\+\_\[\]\|\/\\]{1})/) {

Did you intend to include the variable @& in that regular expression?

Neither $' nor $[ nor $3 contain any "letters" and they are all single character variable names (the sigil does not count as part of the name.)

Also, you don't include single control character names like $^A, $^B, $^C, etc.

Naked blocks are fun! -- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re^2: My Perl Obfuscator
by harangzsolt33 (Chaplain) on Jan 12, 2024 at 16:25 UTC
    Sorry, I meant characters, not letters. Lol

    "Did you intend to include the variable @& in that regular expression?"

    No, it's not included in there. This regex is looking for something that starts with $ and is followed by one of the characters in the list. And @ and & happen to be in the list. But if a variable starts with @, it won't match. But now that I carefully looked at this part of the code, I noticed that if a character appears to be a variable but is not, then it gets eliminated from the double-quoted string instead of being left alone unchanged. I fixed that.

    Today I tried to modify the code to replace variables like $^A, but this caused warnings to appear when running the obfuscated code, because for some reason $^A is treated almost like $a or $b (I have never used these variables ever and don't even understand what they are for) but they apparently don't need to be declared. But if I come up with a new variable such as $XX and start using it in place of $^A, then perl is going to say wait a minute, you didn't declare $XX anywhere in the code, you just started using it.

      $^A is already obfuscated, so no need to obfuscate them twice ;-)
      For using their unobfuscated form, you have to use English; and you can look them up in perlvar (including $a and $b)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11156907]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-05-18 17:44 GMT
Find Nodes?
    Voting Booth?

    No recent polls found