Solved

simple syntax question

Posted on 2004-08-25
3
142 Views
Last Modified: 2010-03-05
Hi,

Is there anything wrong with the following in Perl:

if(0){;}
elsif(($char eq "'") or ($char == '"')){;}

Perl does not seem to like '"', but I think it is valid.
0
Comment
Question by:rmundkowsky
3 Comments
 
LVL 18

Accepted Solution

by:
kandura earned 50 total points
ID: 11898032
You're right:

    c:\> perl -c
    if(0){;}
    elsif(($char eq "'") or ($char == '"')){;}
   
    - syntax OK

Maybe the error occurs further up your script?
0
 

Author Comment

by:rmundkowsky
ID: 11898049
Ah, yep you got it.  Thanks
0
 
LVL 84

Expert Comment

by:ozo
ID: 11919346
perl -Mdiagnostics -w
if(0){;}
elsif(($char eq "'") or ($char == '"')){;}

Use of uninitialized value in string eq at - line 1 (#1)
    (W uninitialized) An undefined value was used as if it were already
    defined.  It was interpreted as a "" or a 0, but maybe it was a mistake.
    To suppress this warning assign a defined value to your variables.
   
    To help you figure out what was undefined, perl tells you what operation
    you used the undefined value in.  Note, however, that perl optimizes your
    program and the operation displayed in the warning may not necessarily
    appear literally in your program.  For example, "that $foo" is
    usually optimized into "that " . $foo, and the warning will refer to
    the concatenation (.) operator, even though there is no . in your
    program.
   
Argument """ isn't numeric in numeric eq (==) at - line 1 (#2)
    (W numeric) The indicated string was fed as an argument to an operator
    that expected a numeric value instead.  If you're fortunate the message
    will identify which operator was so unfortunate.
   
Use of uninitialized value in numeric eq (==) at - line 1 (#1)
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question