Solved

simple syntax question

Posted on 2004-08-25
3
139 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
Comment Utility
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
Comment Utility
Ah, yep you got it.  Thanks
0
 
LVL 84

Expert Comment

by:ozo
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
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 …
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

744 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now