zalgo (718B)
- #!/usr/bin/perl
- # SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- # SPDX-License-Identifier: MPL-2.0
- 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]);
- }
- }