musterion has asked for the wisdom of the Perl Monks concerning the following question:
Example input:require 5.8.5; use strict; no strict 'subs'; use warnings; use encoding 'utf8'; use Carp; use English; use GDBM_File; binmode STDIN, ':utf8'; binmode STDOUT, ':utf8'; binmode STDERR, ':utf8'; my $count = 0; my %keys; my $file = "FAST.gdbm"; tie (%keys, GDBM_File, $file, &GDBM_WRCREAT, 0644) || die ("could not +open:$file"); while (my $line = <STDIN>) { chomp $line; my ($key, $heading) = split (/\t/, $line); eval { $keys{$key} = $heading; }; if ("" ne $EVAL_ERROR) { print $line, "\n"; } if (0 == (++$count % 10000)) { print STDERR "$count loaded\n"; } } print STDERR "$count loaded\n";
fst01710268 $aCinéma vérité films fst01710335 $aSchulmaˆdchen-Report films fst01710349 $aAngélique films fst01710442 $aTrapalhoƒes films fst01726204 $aFanto‚mas films fst01726458 $aFluˆgelhorn music (Jazz) fst01726727 $aRomans a€ clef
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: utf8 and GDBM
by ikegami (Patriarch) on Jun 09, 2010 at 21:39 UTC | |
|
Re: utf8 and GDBM
by Khen1950fx (Canon) on Jun 09, 2010 at 20:51 UTC |