stem from using incorrect syntax for opening the DBI connection to your database. At line 77 of your script, this:Useless use of a constant in void context at libbuilder.pl line 77.
should be something like this:$dbh = ("DBI:mysql:host=localhost; database=blah", "blah", "blah", {PrintError => 0, RaiseError=>1});
The other messages all stem from these lines, I think:$dbh = DBI->connect( "DBI:mysql:host=localhost;database=blah", $user, $passwd, {PrintError=>0,RaisError=>1});
and there's a lot of trouble there. First, it's good you are using strict, because you declared "index" as a hash ("my %index") but in these lines just cited, your using a scalar variable called "$index", and treating it as a reference to a hash. Make it a hash, or make it a scalar that you use as a hash-ref -- don't do it both ways.$index->{$word} = ( exists $index->{$word} ? "$index->{$word}:" : "" ) . "$file_id" unless $seen_in_file{$word}++;
Another problem with those lines is the syntax. I think you want something like this:
Don't try using the ternary operator together with a post-conditional in the same statement -- it's too complicated, and you obviously did it wrong. So just keep it simple and clear.if ( ! $seen_in_file{$word} ) { $index{$word} .= ":" if ( exists( $index{$word} )); $index{$word} .= $file_id; $seen_in_file{$word}++; }
update: actually, the message about "missing right curly bracket" is because you really are missing a close-curly just before "sub usage" is declared. As mentioned in an earlier reply, you'll benefit from maintaining proper indentation as you edit your code. There are editors that make this relatively easy, once you learn how to use them.
In reply to Re: Finding local vs Global Error
by graff
in thread Finding local vs Global Error
by Cappadonna3030
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |