Solved

simple syntax question

Posted on 2004-08-25
3
140 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Port 80 requests 16 87
ppm conversion to curl on a module install 8 80
PERL - Find newest folder 12 117
perl: Cleaning meta tags using RegEX 12 62
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…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

911 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