piet@cs.ruu.nl (Piet van Oostrum) (02/20/90)
In article <4004@accuvax.nwu.edu>, henry@garp (Henry Mensch) writes: ` From: tjo@its.bt.co.uk (Tim Oldham) ` Subject: London Code Changes --- Server Now Available ` Date: 16 Feb 90 15:19:08 GMT `From the 6th May 1990, the dialling codes for London UK change. The `old code, 01 (which translates to +44 1 for international calls) is to `be replaced by two different codes, 071 (+44 71) and 081 (+44 81). `Obviously this is going to affect a large number of people. The split `is by geography, so there is no simple rule about what numbers change `from 01 to 071 and which from 01 to 081. However, it is possible to `find out what the new code will be from the first 3 digits of the `telephone number. For example, numbers that began 01 209 will change `to 081 200 while numbers that began 01 210 will change to 071 210. Here is a perl script to do the conversion: #! /local/bin/perl #Usage london telnr #where telnr = nnn-pppp | 01-nnn-pppp | +44-1-nnn-pppp # (pppp optional) $table = "8-888888887-7777-777777777777777777777777777777777" . "77777777777777-77777777777777777-77-777788-8-8-888" . "88888878888888878888777777777787877888788888-88888" . "777777777788-888888-77777777777777777777888888-888" . "77777777777777777778888887888877777777778888888888" . "88887887888888878888888778778877777777777777777777" . "8888888888777787788888788788-888888887788888888878" . "8888888888888888888888888888887777777777888888-888" . "77777777777777-7--7777777777777777777777888888888-" . "88-888888888-8888888888888888888888888888888887888" . "77777-77777777777-77777777777777777777778888888888" . "888788878888-88-8888887877888788888888887777777-77" . "8888888888-8------7777777-7777-7777777778888888888" . "888888888888888887888877888888-888888-8888888--888" . "8788888888-77887777-777777-777777777777788888-8888" . "8888877788887888-888-7778-787888-8888788-88888-88-" ; die "Usage: london telnr\n" if $#ARGV < 0; foreach $telnr (@ARGV) { $result = ''; if ( $telnr =~ /^(\d\d\d)|^01\D*(\d\d\d)|^\+44\D*1\D*(\d\d\d)/) { $nnn = $+; $pppp = $'; if ($nnn >= 200 && $pppp =~ /^\D*$|\D*\d\d\d\d\D*$/) { $digit = substr ($table, $nnn-200, 1); if ($digit != '-') { $result = $telnr; $result =~ s/^0/0$digit/ || $result =~ s/^\+44\D*/$&$digit/ || $result =~ s/^/0${digit}1-/; } } } if ($result) {print "$telnr => $result\n";} else {print "Invalid phone number $telnr\n";} } Piet* van Oostrum, Dept of Computer Science, Utrecht University, Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands. Telephone: +31-30-531806 Uucp: uunet!mcsun!hp4nl!ruuinf!piet Telefax: +31-30-513791 Internet: piet@cs.ruu.nl (*`Pete')