Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 10 characters in body
Source Link
Ton Hospel
  • 15k
  • 1
  • 23
  • 45

Perl 5 -lp, 24 bytes

#!/usr/bin/perl -lp
$_=(grep!eval,a..zz)[$_]

Try it online!

Easy to extend to more and longer keywords, but you will need to do special casing starting at 4 letters because you will get stuck onrun into problems with dump, eval, exit,getc etc..

Of course just outputting operators and sigils is boring but shorter at 11 bytes:

#!/usr/bin/perl -lp
$_=chr$_+35

Try it online!

(I skipped # since it's unclear how I should classify it in the context of this challenge)

Perl 5 -lp, 24 bytes

#!/usr/bin/perl -lp
$_=(grep!eval,a..zz)[$_]

Try it online!

Easy to extend to more and longer keywords, but you will need to do special casing starting at 4 letters because you will get stuck on dump, eval, exit,getc etc..

Of course just outputting operators and sigils is boring but shorter at 11 bytes:

#!/usr/bin/perl -lp
$_=chr$_+35

Try it online!

(I skipped # since it's unclear how I should classify it in the context of this challenge)

Perl 5 -lp, 24 bytes

#!/usr/bin/perl -lp
$_=(grep!eval,a..zz)[$_]

Try it online!

Easy to extend to more and longer keywords, but you will need to do special casing starting at 4 letters because you will run into problems with dump, eval, exit,getc etc..

Of course just outputting operators and sigils is boring but shorter at 11 bytes:

#!/usr/bin/perl -lp
$_=chr$_+35

Try it online!

(I skipped # since it's unclear how I should classify it in the context of this challenge)

Source Link
Ton Hospel
  • 15k
  • 1
  • 23
  • 45

Perl 5 -lp, 24 bytes

#!/usr/bin/perl -lp
$_=(grep!eval,a..zz)[$_]

Try it online!

Easy to extend to more and longer keywords, but you will need to do special casing starting at 4 letters because you will get stuck on dump, eval, exit,getc etc..

Of course just outputting operators and sigils is boring but shorter at 11 bytes:

#!/usr/bin/perl -lp
$_=chr$_+35

Try it online!

(I skipped # since it's unclear how I should classify it in the context of this challenge)

AltStyle によって変換されたページ (->オリジナル) /