Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

syntax error

Posted on 2002-03-03
3
Medium Priority
?
150 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
  • 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 200 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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…
Six Sigma Control Plans

824 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