Skip to content

Instantly share code, notes, and snippets.



Created Nov 30, 2011
What would you like to do?
#!/usr/bin/env perl
use strict;
use warnings;
use Pod::Usage;
use Getopt::Long;
use File::Slurp 'slurp';
my %options;
GetOptions(\%options, "--show", "--help");
run(\%options, @ARGV);
sub run {
my ($opts, @args) = @_;
pod2usage(0) if $opts->{help};
my @files;
if (@args == 0) {
@files = (join '', <STDIN>);
} else {
for my $arg (@args) {
push @files, slurp $arg;
for my $file (@files) {
if ($opts->{show}) {
print show($file), "\n";
} else {
print hide($file), "\n";
sub hide {
my $text = shift;
$text = unpack "b*", $text;
$text =~ tr/01/ \t/;
sub show {
my $text = shift;
$text =~ tr/ \t/01/;
$text = pack "b*", $text;
=head1 NAME
s3cr3t - 'hide' and 'unhide' text files
s3cr3t OPTION file1 [file2 ...]
-s, --show Show hidden text(reverse hide mode)
-h, --help Display the help information
$ s3cr3t --help
$ s3cr3t a.txt > a.hidden
$ s3cr3t a.hidden
$ cat a.txt | s3cr3t
No more description.
=head1 LICENSE
same as Perl.
=head1 AUTHOR
Hyungsuk Hong
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.