Skip to content

Instantly share code, notes, and snippets.

@chew-z
Created March 20, 2017 03:39
Show Gist options
  • Save chew-z/68ef908bdf1c5457c9082c04cc3b9fb3 to your computer and use it in GitHub Desktop.
Save chew-z/68ef908bdf1c5457c9082c04cc3b9fb3 to your computer and use it in GitHub Desktop.
creates zeitgeist format from words list (for TrackMeNot)
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw(say);
my $outfile = 'zeitgeist.txt';
open(my $fh, '>', $outfile) or die "Cannot create $outfile, $!\n";
my $file = $ARGV[0] or die "Need to get file containing words on the command line\n";
open(my $data, '<', $file) or die "Could not open '$file' $!\n";
my $linenumber = 0;
print $fh "[";
while (my $line = <$data>) {
$linenumber += 1;
chomp $line;
my $word = qq{"$line",};
print $fh "$word";
}
print $fh "]";
close $fh or die "Error in closing the file ", __FILE__, " $!\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment