Solved

syntax error

Posted on 2002-03-03
3
144 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 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

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

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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

13 Experts available now in Live!

Get 1:1 Help Now