[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Problems



I get a "compilation error at line 29" message when I syntax-check the
following code with MacPerl 5.07 on a Performa 5200 (this code comes from
"Perl 5 how-to" and should run ok) :

# Nom : pattern.pl
# Date : 16/12/96
# Ecrit par : Philippe de Rochambeau
# Source : Perl 5 How-To, Waite Group Press, p. 269
# Objectif : rechercher un mot ou tous les mots similaires dans la base

#!/usr/local/bin/perl -w

# User the DBM module.
# use Getopt::Long;
use DB_File;
use Fcntl;

# Set up the command line options.
# ...

my $database = "convert.dbm";
my $pattern = "the";
my ($key, %inventory);

# Open the input file.
tie (%inventory, DB_File, $database, O_RDONLY, 0700) ||
 die "Could not open DBM file $database : $!\n";

# Start looking for the pattern we were given.
for $key (keys %inventory)
{
                                # Look for the 'sounds-like' pattern...
                                if ($inventory{$key} =~ $pattern)
                                {
                                                                print
"Match found ($pattern) =~ <$inventory{$key}\n>";
                                }
}

# Close the dbm database
untie %inventory;

----- end of code ----

Can anyone tell me what is wrong with it?

Philippe de Rochambeau

______________________________________________________________________________
Philippe de Rochambeau
pr1@club-internet.fr