zalgo (720B)
- #!/usr/bin/perl
- # Copyright 2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- # SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
- use strict;
- use warnings;
- no warnings 'utf8'; # Wide Character warning
- my $level = 10;
- if($#ARGV == 0) {
- $level = int($ARGV[0]) or die;
- }
- my $file = '/usr/share/unicode-data/UnicodeData.txt';
- open my $fh , '<:encoding(UTF-8)', $file or die;
- my @combinings = ();
- while(my $line = <$fh>) {
- if($line =~ /;COMBINING/) {
- my @fields = split ";", $line;
- push(@combinings, hex($fields[0]));
- }
- }
- close $fh;
- my @input;
- {
- undef $/;
- @input = split "", <STDIN>;
- }
- foreach(@input) {
- print $_;
- foreach(1..$level) {
- print pack("U", $combinings[rand @combinings]);
- }
- }