Hi, I try to run a program in perl and face the error:
"use " not allowed in expressing at program.pl line 6, at end of line
syntax error at program.pl line 6 near "use Carp"
and in line 6 I have:
use Carp;
now, How can I resolve the problem?
Thanks!
Excuse me! I want to make some changes in my question:
I want to run fuzzy cmeans clustering. I made a folder named Algorithm and saved the algorithm in .pm format into it. Then save notepad file contained the following matter:
use Algorithm::FuzzyCmeans;
# input documents
my %documents = (
Alex => { 'Pop' => 10, 'R&B' => 6, 'Rock' => 4 },
Bob => { 'Jazz' => 8, 'Reggae' => 9 },
Dave => { 'Classic' => 4, 'World' => 4 },
Ted => { 'Jazz' => 9, 'Metal' => 2, 'Reggae' => 6 },
Fred => { 'Hip-hop' => 3, 'Rock' => 3, 'Pop' => 3 },
Sam => { 'Classic' => 8, 'Rock' => 1 },
);
my $fcm = Algorithm::FuzzyCmeans->new(
distance_class => 'Algorithm::FuzzyCmeans:
istance::Cosine',
m => 2.0,
);
foreach my $id (keys %documents) {
$fcm->add_document($id, $documents{$id});
}
my $num_cluster = 3;
my $num_iter = 20;
$fcm->do_clustering($n
"use " not allowed in expressing at program.pl line 6, at end of line
syntax error at program.pl line 6 near "use Carp"
and in line 6 I have:
use Carp;
now, How can I resolve the problem?
Thanks!
Excuse me! I want to make some changes in my question:
I want to run fuzzy cmeans clustering. I made a folder named Algorithm and saved the algorithm in .pm format into it. Then save notepad file contained the following matter:
use Algorithm::FuzzyCmeans;
# input documents
my %documents = (
Alex => { 'Pop' => 10, 'R&B' => 6, 'Rock' => 4 },
Bob => { 'Jazz' => 8, 'Reggae' => 9 },
Dave => { 'Classic' => 4, 'World' => 4 },
Ted => { 'Jazz' => 9, 'Metal' => 2, 'Reggae' => 6 },
Fred => { 'Hip-hop' => 3, 'Rock' => 3, 'Pop' => 3 },
Sam => { 'Classic' => 8, 'Rock' => 1 },
);
my $fcm = Algorithm::FuzzyCmeans->new(
distance_class => 'Algorithm::FuzzyCmeans:

m => 2.0,
);
foreach my $id (keys %documents) {
$fcm->add_document($id, $documents{$id});
}
my $num_cluster = 3;
my $num_iter = 20;
$fcm->do_clustering($n