Solved

syntax error

Posted on 2002-03-03
3
147 Views
Last Modified: 2010-03-05
What wrong in this code ?

use File::Copy;
move("c:/a.a","c:/a.done")
         or {
             print("1st msg\n");
             print("2nd msg\n");
         }
0
Comment
Question by:addady
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Expert Comment

by:maneshr
ID: 6837860
addady,

"..What wrong in this code ?.."

What exactly does/does not happen?

Do you get an error? Please provide more details.

This will help you get a more accurate answer, faster.
0
 
LVL 16

Expert Comment

by:maneshr
ID: 6837864
addady,

Meanwhile, try this variation of your code.

use File::Copy;

if (!(move("c:/a.a","c:/a.done"))){
  print("1st msg\n");
  print("2nd msg\n");
}

Let me know how it goes.
0
 
LVL 1

Accepted Solution

by:
japhyRPI earned 50 total points
ID: 6838163
What's wrong is that the "or" operator requires two EXPRessions.  A BLOCK is not an EXPRession; your code has

  {
    print ...;
    print ...;
  }

which is a BLOCK.  You can use the 'do' keyword to make that BLOCK an EXPRession:

  move("C:/a.a" => "C:/a.done") or do {
    print ...;
    print ...;
  };
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…

710 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