[TAG] 2 cent tip: reading Freelang dictionaries
Jimmy O'Regan
joregan at gmail.com
Sun Sep 5 21:55:24 MSD 2010
On 5 September 2010 17:30, Ben Okopnik <ben at linuxgazette.net> wrote:
> ```
> #!/usr/bin/perl -w
> # Created by Ben Okopnik on Sun Sep ?5 12:11:02 EDT 2010
> use strict;
>
> die "Usage: ", $0 =~ /([^\/]+)$/, " <dict_file> [encoding]\n"
> ? ?unless @ARGV;
>
> use open IN => ":encoding(" . (defined $ARGV[1]?$ARGV[1]:'utf8') . ")",
> ? ?OUT => ":utf8";
>
> (my $dct = $ARGV[0]) =~ s/\.wb$//;
> $dct =~ tr/_ A-Z/-_a-z/;
> open my $in, $ARGV[0] or die "$ARGV[0]: $!\n";
> open my $out, "|/usr/bin/dictfmt -f --utf8 $dct"
> ? ?or die "Pipe failure: $!\n";
>
print $out "00-dummy-entry\n For dictfmt\n\n";
here will get rid of the second bug I had
--
<Leftmost> jimregan, that's because deep inside you, you are evil.
<Leftmost> Also not-so-deep inside you.
More information about the TAG
mailing list