Re: Converting using a hash

2003-12-17 Thread Jeff 'japhy' Pinyan
On Dec 17, Jan Eden said: >thanks a lot for all the responses. Jeff's explanation of the snippet I >mentioned in my original message did the trick. The hash-based solution >is much faster now, although the first attempt (using multiple >replacements on standard input) is still the fastest. Well,

Re: Converting using a hash

2003-12-17 Thread Jan Eden
Hi all, thanks a lot for all the responses. Jeff's explanation of the snippet I mentioned in my original message did the trick. The hash-based solution is much faster now, although the first attempt (using multiple replacements on standard input) is still the fastest. To answer John's question

Re: Converting using a hash

2003-12-16 Thread Jeff 'japhy' Pinyan
On Dec 16, Jan Eden said: >>#!perl >> >>%enctabelle = (...); >> >>my $re = '(' . join('|', map quotemeta($_), keys %enctabelle) . ')'; >>$re = qr/$re/; >> >>while (<>) { >> s/$re/$enctabelle{$1}/g; >> print; >>} Let me explain this for you, and fix it, too. # this produces 'key1|key2|key3|..

Re: Converting using a hash

2003-12-16 Thread John W. Krahn
Jan Eden wrote: > > Hi, Hello, > sorry for the lengthy post. > > I recently wrote a Perl script to convert 8-bit characters to LaTeX > commands. The first version (which works just fine) looks like this > (the ... indicates more lines to follow): Your regular expressions look like they are lon

Re: Converting using a hash

2003-12-16 Thread Jenda Krynicky
From: Jan Eden <[EMAIL PROTECTED]> > I recently wrote a Perl script to convert 8-bit characters to LaTeX > commands. The first version (which works just fine) looks like this > (the ... indicates more lines to follow): > > >#!/usr/bin/perl -pw > > > >s/âÇ?/{\\glqq}/g; > >s/âÇ?/{\\grqq}/g; > >s/Ăí/\

Converting using a hash

2003-12-16 Thread Jan Eden
Hi, sorry for the lengthy post. I recently wrote a Perl script to convert 8-bit characters to LaTeX commands. The first version (which works just fine) looks like this (the ... indicates more lines to follow): >#!/usr/bin/perl -pw > >s/â/{\\glqq}/g; >s/â/{\\grqq}/g; >s/Ã/\\'{a}/g; >s/Ã/\\`{a}/