Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
2 Be upfront about the fact that this is slight rule abuse
source | link

Perl, 35 bytes

Include +1 for -p

Somewhat abusive since it depends on the program being given on the commandline.

perl -pe'<>=~s%\S%*_=s/$&//i?_:0%reg;$_=!//'

Then give the strings as 2 consecutive lines on STDIN

A morevery abusive solution is 30 bytes:

perl -ne'<>=~s%\w%1/!s/$&//i%reg;1/!//'

This crashes if the strings are not anagrams and therefore gives a false exit code from the point of view of the shell. It also gives garbage on STDERR for that case. If the strings are anagrams the program is silent and gives a "true" exit code

Perl, 35 bytes

Include +1 for -p

perl -pe'<>=~s%\S%*_=s/$&//i?_:0%reg;$_=!//'

Then give the strings as 2 consecutive lines on STDIN

A more abusive solution is 30 bytes:

perl -ne'<>=~s%\w%1/!s/$&//i%reg;1/!//'

This crashes if the strings are not anagrams and therefore gives a false exit code from the point of view of the shell. It also gives garbage on STDERR for that case. If the strings are anagrams the program is silent and gives a "true" exit code

Perl, 35 bytes

Include +1 for -p

Somewhat abusive since it depends on the program being given on the commandline.

perl -pe'<>=~s%\S%*_=s/$&//i?_:0%reg;$_=!//'

Then give the strings as 2 consecutive lines on STDIN

A very abusive solution is 30 bytes:

perl -ne'<>=~s%\w%1/!s/$&//i%reg;1/!//'

This crashes if the strings are not anagrams and therefore gives a false exit code from the point of view of the shell. It also gives garbage on STDERR for that case. If the strings are anagrams the program is silent and gives a "true" exit code

1
source | link

Perl, 35 bytes

Include +1 for -p

perl -pe'<>=~s%\S%*_=s/$&//i?_:0%reg;$_=!//'

Then give the strings as 2 consecutive lines on STDIN

A more abusive solution is 30 bytes:

perl -ne'<>=~s%\w%1/!s/$&//i%reg;1/!//'

This crashes if the strings are not anagrams and therefore gives a false exit code from the point of view of the shell. It also gives garbage on STDERR for that case. If the strings are anagrams the program is silent and gives a "true" exit code