Can't find string terminator "`" anywhere before EOF at /usr/local/lib/perl/5.6.1/BuildLink.pm line 59.
Compilation failed in require at ./test.pl line 4.
BEGIN failed--compilation aborted at ./test.pl line 4.
I'm just playing with some code and trying out some new things, so please don't expect the following code to be nirvana.
Here's the script which calls the module:
#!/usr/bin/perl -w use strict; use BuildLink; my $file = "/www/htdocs/shock/history.php"; my @words = buildLinks($file); print @words;
Not much to that. Here's the module:
package BuildLink; use strict; use Exporter; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); $VERSION = 1.00; @ISA = qw(Exporter); @EXPORT = (); @EXPORT_OK = qw(&buildLinks); %EXPORT_TAGS = ( DEFAULT => [qw(&buildLinks)]); my @linkedFile = buildLinks(@_); return @linkedFile; sub buildLinks { my $FileName = shift; my @wordList = bustFile($FileName); } sub bustFile { my $FileName = shift; open(IN, "$FileName") || die "Cannot open $FileName: $!\n"; my @text = do {local $/; <IN> }; @pieces = split_text(@text); @pieces = check_links(@pieces); return @pieces; } sub split_text { $_[0] =~ /("[^"]*"|[^\s"]+)/g; $_[0] =~ s/\.$//g; $_[0] =~ s/^\.//g; $_[0] =~ s/\s$//g; $_[0] =~ s/^\s//g; } sub check_links { my @pieces = @_; my @list; open(WORDLIST,"/www/htdocs/data/linklist.txt") || die "Cannot open /www/htdocs/data/linklist.txt: $!\n"; foreach my $word (@pieces){ open(WORDLIST,"/www/htdocs/data/linklist.txt") || die "Cannot open /www/htdocs/data/linklist.txt: $!\ +n"; my ($checkLine, $checkWord, $checkLink); while ($checkLine = <WORDLIST>) { ($checkWord, $checkLink) = split(/\t/, $checkLine); if ($word eq $checkWord) { $word = "<a href=\"$checkLink\">$word</a>";` } push @list, $word; last if ($checkWord gt $word); } close WORDLIST; } return @list; } 1;
Any thoughts on how to correct this error would be great. Thanks!
If things get any worse, I'll have to ask you to stop helping me.
In reply to Can't find string terminator by shockme
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |