Solved

syntax error

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
Strange perl issue 6 131
Expect & sshpass package for Solaris 10 x86 15 991
syslog unix file 20 78
Merging two files with Perl 5 25
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…
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…

735 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