in reply to Re^2: Non-Formula based Text Encoding - with Compression
in thread Non-Formula based Text Encoding - with Compression
"You all need to read the comments ..."
To be fair, you really could have made the "instructions" more clear, but i did take your suggestion and re-read your comments and came up with the following code:
And yes, this is kind of cool. Why you didn't provide an end-to-end complete example is probably the root of your down-votes on the OP.#!/usr/bin/env perl use strict; use warnings; use Data::Dumper; use List::Util qw( shuffle ); my $str = shift || 'The impatient fox jumped over the lazy camel with +hubris.'; my( @codes, %encode ); my @base = ('a' .. 'z', 'A' .. 'Z', 0 .. 9); for my $i (@base) { push @codes, $i; for my $j (@base) { push @codes, "$i$j"; for my $k (@base) { push @codes, "$i$j$k"; } } } @codes = shuffle @codes; for (split /\s+/, $str) { $encode{$_} = shift @codes; } $str =~ s/([A-Za-z0-9.]+)/$encode{$1}/eg; print $str,$/; my %decodes = reverse %encode; $str =~ s/(\w+)/$decodes{$1}/eg; print $str,$/;
"It is obvious to any Perl developer worth his salt what the code is doing and what the purpose is."
Just remember, the more time you spend ensuring that your documentation is unambiguous, clear and complete the less time you'll spend defending your position, which essentially boils down to an inability to communicate effectively. Next time ... take the time to make your presentation more presentable -- in other words, implement the purpose as well.
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Non-Formula based Text Encoding - with Compression
by Aldebaran (Curate) on Apr 22, 2015 at 06:32 UTC |