Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9273873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:12:58+00:00 2026-06-18T16:12:58+00:00

I can’t seem to figure out why I’m getting this error when trying to

  • 0

I can’t seem to figure out why I’m getting this error when trying to run my .pl script.

Here is the script:

# mini script for creating diff files in a single directory

# directory of patch files
$patchDir = "c:\oc\Patch Files";

if ($#ARGV != 1 && $#ARGV != 2)
{
    print "Usage: diff <file name> [-s]\n";
    print "Example:  \n";
    print "   |Diff relative to Index (staged)|  :  diff MOM00123456_1.patch \n";
    print "   |Diff Staged|                      :  diff MOM00123456_1.patch -s \n";
    exit;
}

$fileName = $ARGV[0];

if ($#ARGV == 2)
    $stagedArg = $ARGV[1];

if ($stagedArg)
    if ($stagedArg == "-s" || $stagedArg == "-S")
        system("git diff --staged --full-index > $fileName $patchDir");
    else
    {
        print "Unknown argument:  $stagedArg\n";
        exit;
    }
else
    system("git diff --full-index > $fileName $patchDir");

Test:

diff.pl test.patch -s

Output:

Scalar found where operator expected at C:\utils\diff.pl line 18, near

")

$stagedArg"

(Missing operator before $stagedArg?) syntax error at C:\utils\diff.pl line 18, near ")

$stagedArg " syntax error at C:\utils\diff.pl line 21, near ")

if" Execution of C:\utils\diff.pl aborted due to compilation errors.

Execution of C:\utils\diff.pl aborted due to compilation errors.

Can someone shed some light?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T16:13:00+00:00Added an answer on June 18, 2026 at 4:13 pm

    Perl if syntax is:

    if (condition) {
        statements;
    }
    

    You can’t omit the curly braces.


    You might find use diagnostics; useful. Given a simple test script:

    use strict;
    use warnings;
    use diagnostics;
    if (1) 
        print 1;
    

    We get:

    syntax error at - line 5, near ") 
        print"
    Execution of - aborted due to compilation errors (#1)
    

    (F) Probably means you had a syntax error. Common reasons include:

    • A keyword is misspelled.
    • A semicolon is missing.
    • A comma is missing.
    • An opening or closing parenthesis is missing.
    • An opening or closing brace is missing.
    • A closing quote is missing.

    Often there will be another error message associated with the syntax
    error giving more information. (Sometimes it helps to turn on -w.)
    The error message itself often tells you where it was in the line when
    it decided to give up. Sometimes the actual error is several tokens
    before this, because Perl is good at understanding random input.
    Occasionally the line number may be misleading, and once in a blue moon
    the only way to figure out what’s triggering the error is to call
    perl -c repeatedly, chopping away half the program each time to see
    if the error went away. Sort of the cybernetic version of 20 questions.

    Uncaught exception from user code:
        syntax error at - line 5, near ") 
            print"
        Execution of - aborted due to compilation errors.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone help me trying to find out why this doesn't work. The brushes
Can any one help me in sorting this out in sed/awk/perl Input file Start
Can find why i get this error can someone help? package Android.data; public class
Can someone help me figure out why my logo image isn't resizing according the
Can we change the default action of the edit selected row button? Here is
Can anyone explain to me why this program: for(float i = -1; i <
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Can someone tell me where I'm going wrong here? basically I've written some code
Can someone please help me find the memory leak which is occurring here? I
Can anyone tell me what i am doing wrong? I am trying to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.