Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Error & quot

Reply
Thread Tools

Error & quot

 
 
geek
Guest
Posts: n/a
 
      02-09-2005
Hi all,

I am getting following error when I try to run the script a part of
which is shown below.

Error:<PRE>syntax error at sem_reg_test.cgi line 192, near &quot;|| die
&quot;$0&quot;

Any help will be appreciated.

Thanks,
MJ

================================================== =======================
else {
open(COURSEINFO,$coursefile)
|| die "$0: Could not read course information ($coursefile):
$!\n";

# flock(COURSEINFO, 1);

while (<COURSEINFO>) {
# remove trailing newline
chomp;

# save comments and blank lines
if (/^#/ || /^\s*$/) {
push(@courses_new, $_);
next;
}

 
Reply With Quote
 
 
 
 
geek
Guest
Posts: n/a
 
      02-09-2005
Sorry for the confusion .
I have specified the line # in the code.
Exactly even I don't see any $quot in my script infact I know there is
no $quot in the script.

Thanks,
MJ
geek wrote:
> Hi all,
>
> I am getting following error when I try to run the script a part of
> which is shown below.
>
> Error:<PRE>syntax error at sem_reg_test.cgi line 192, near &quot;||

die
> &quot;$0&quot;
>
> Any help will be appreciated.
>
> Thanks,
> MJ
>
>

================================================== =======================
> else {
> open(COURSEINFO,$coursefile)
> line:192 || die "$0: Could not read course information

($coursefile):
> $!\n";
>
> # flock(COURSEINFO, 1);
>
> while (<COURSEINFO>) {
> # remove trailing newline
> chomp;
>
> # save comments and blank lines
> if (/^#/ || /^\s*$/) {
> push(@courses_new, $_);
> next;
> }


 
Reply With Quote
 
 
 
 
John Bokma
Guest
Posts: n/a
 
      02-09-2005
geek wrote:

> Hi all,
>
> I am getting following error when I try to run the script a part of
> which is shown below.
>
> Error:<PRE>syntax error at sem_reg_test.cgi line 192, near &quot;|| die
> &quot;$0&quot;


And which line is 192?

--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html

 
Reply With Quote
 
geek
Guest
Posts: n/a
 
      02-09-2005
Here is the code with line number in it :

else {
> open(COURSEINFO,$coursefile)
> line:192 || die "$0: Could not read course information

($coursefile):
> $!\n";


> # flock(COURSEINFO, 1);


> while (<COURSEINFO>) {
> # remove trailing newline
> chomp;


> # save comments and blank lines
> if (/^#/ || /^\s*$/) {
> push(@courses_new, $_);
> next;
> }


 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      02-10-2005
geek <> wrote:


> Exactly even I don't see any $quot in my script infact I know there is
> no $quot in the script.



There is no $quot in the message either, so I don't know why
you are speaking of it...


> geek wrote:


>> Error:<PRE>syntax error at sem_reg_test.cgi line 192, near &quot;||

> die
>> &quot;$0&quot;




--
Tad McClellan SGML consulting
Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      02-10-2005
geek <> wrote:

> I am getting following error when I try to run the script a part of
> which is shown below.
>
> Error:<PRE>syntax error at sem_reg_test.cgi line 192, near &quot;|| die
> &quot;$0&quot;



Carp is adding the &quot; entities, the message is supposed to look
like this:

syntax error at sem_reg_test.cgi line 192, near "|| die "$0"

(but that looks like one extra quote to me...)


> else {
> open(COURSEINFO,$coursefile)
> || die "$0: Could not read course information ($coursefile):
> $!\n";



That looks OK to me, the problem must be in the lines preceding
those that you have shown us.

There is no extra quote there, it seems that the code and the
error message do not match...


--
Tad McClellan SGML consulting
Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Tony Curtis
Guest
Posts: n/a
 
      02-10-2005

[ top-posting rearranged ]

>> On 9 Feb 2005 14:36:54 -0800,
>> "geek" <> said:


>> Error:<PRE>syntax error at sem_reg_test.cgi line 192, near
>> &quot;||

> die
>> &quot;$0&quot;
>>


> Sorry for the confusion . I have specified the line # in
> the code. Exactly even I don't see any $quot in my script
> infact I know there is no $quot in the script.


That's probably an attempt at returning HTML to you, but
without the HTTP headers to identify it as such so the browser
you're viewing the output in isn't rendering it.

You'll need to show the context of the code, I'd suggest about
10 lines either side of the indicated line. Show the code
with line numbers, e.g. as output by "cat -n".

hth
t
 
Reply With Quote
 
geek
Guest
Posts: n/a
 
      02-11-2005
Here is the code that is giving the error
I have marked line 191.
The error I get is
<PRE>syntax error at sem_reg_test.cgi line 191, near &quot;open
(COURSEINFO, &qu
ot;$coursefile&quot;
Global symbol &quot;$item&quot; requires explicit package name at
sem_reg_test.c
gi line 230.
Global symbol &quot;$item&quot; requires explicit package name at
sem_reg_test.c
gi line 230.

################################################## ##############################
# Reads in course information from file
sub read_course_info {
my @allcourse = ("basic_mtx.data","packet_mtx.data") ;
# Checking the directory for available courses
if($set eq "all")
{
foreach my $mycourse(@allcourse){
open (AllINFO, "data/$mycourse")
|| die "$0: could not read course information:$!;
while(<ALLINFO>){
# removing trailing newline
chomp;

# Save comments and blank lines
if(/^#/ || /^\s*$/){
push(@courses_new, $_);
next;
}
#accumulate list of courses
push(@courses,$_);
}
close(ALLINFO);
}

else {

Line 191 pen (COURSEINFO, "$coursefile")
|| die "$0:could not read course information ($coursefile):
$!\n";

# flock(COURSEINFO, 1);

while (<COURSEINFO>) {
# remove trailing newline
chomp;

# save comments and blank lines
if (/^#/ || /^\s*$/) {
push(@courses_new, $_);
next;
}

# accumulate list of courses
push(@courses, $_);
}

close(COURSEINFO);

}
}
################################################
Any help will be appreciated.

Thanks,
MJ

 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      02-11-2005
geek <> wrote:

> The error I get is
><PRE>syntax error at sem_reg_test.cgi line 191, near &quot;open
> (COURSEINFO, &qu
> ot;$coursefile&quot;



> open (AllINFO, "data/$mycourse")
> || die "$0: could not read course information:$!;

^
^

Where is the closing quote?


> Line 191 pen (COURSEINFO, "$coursefile")



perldoc -q vars

What's wrong with always quoting "$vars"?

so that should be

open (COURSEINFO, $coursefile)


--
Tad McClellan SGML consulting
Perl programming
Fort Worth, Texas
 
Reply With Quote
 
geek
Guest
Posts: n/a
 
      02-11-2005
Thanks so much for help.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"american think tanks" "american thanksgiving 2009" "americanthanksgiving" "american think tanks list" "american express" on saima81 Python 0 12-22-2009 06:05 PM
a = [ "1", "2", "3" ] v/s a = new Array ( "1", "2", "3" )identical in all ways? okey Javascript 1 08-25-2009 12:56 PM
"ADMISSION IN FA FSC" "ADMISSION IN FA/FSC" "ADMISSION IN GCUNIVERSITY LAHORE" "ADMISSION IN SCIENCE COLLEGE LAHORE" "ADMISSION IN KIPSLAHORE" "ADMISSION IN LEADERSHIP COLLEGE LAHORE" " Riaz Ahmad Python 0 08-01-2009 07:02 AM
"JOBS IN USA" "USA JOBS" "USA GOVT JOBS" "USAJOBS" "USAJOBS" saima81 Python 0 07-31-2009 08:25 PM
<FORM METHOD="post" onSubmit="return fieldcheck()" name="orientation" action="http://ws-kitty.BU.edu/AT/survey/orientation/script/write.asp" language="JavaScript"> Joeyej ASP .Net 0 06-04-2004 07:55 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57