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

  • Home
  • SEARCH
  • 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 8644877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:24:26+00:00 2026-06-12T12:24:26+00:00

I have following line in my perl script (which I run from cshell) system(perl

  • 0

I have following line in my perl script (which I run from cshell)

system("perl -p -i -e 's/\+[a-z]+\+//g' $file1");

I expect it to delete all the words which are surrounded by + plus signs. Instead, I’m getting below error message.

Quantifier follows nothing in regex; marked by <– HERE in m/+ <– HERE [a-z]++/ at -e line 1.

What is happening? I gave backslashes, why then this error?

  • 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-12T12:24:28+00:00Added an answer on June 12, 2026 at 12:24 pm

    Let’s say $file1 contains -foo bar.txt, the string literal

    "perl -p -i -e 's/\+[a-z]+\+//g' $file1"
    

    produces the string

    perl -p -i -e 's/+[a-z]++//g' -foo bar.txt
                     ^      ^     ^   ^
                     |      |     |   |
                     +---- errors ----+
    

    Don’t create a shell command when you don’t need to. Just launch perl directly.

    system("perl", "-p", "-i", "-e", 's/\+[a-z]+\+//g', '--', $file1)
    

    But why create a new process at all? You can use the following to do the exact same thing!

    {
        local @ARGV = $file1;
        local $^I = '';
        while (<>) {
            s/\+[a-z]+\+//g;
            print;
        }
    }
    

    Or as a sub:

    sub fixer {
        my $pat = shift;
        local @ARGV = @_;
        local $^I = '';
        while (<>) {
            s/$pat//g;
            print;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following snippet calling a perl script which writes to STDERR and
I have written a simple perl script to read a line from a .csv
I have a config file that contains the following line: pre_args='$REGION','xyz',3 Using perl from
I have the following line in my Perl script: s/b(w+)b/ $replaces{$1} ? $replaces{$1} :
I have the following Perl script. I am trying to run it in Windows
I have the following line of code called very often: var configValue = System.Configuration.ConfigurationManager.AppSettings[ConfigValueKey];
I have the following, simplest Perl CGI script: use strict; use warnings; use CGI();
I have the following Perl script counting the number of Fs and Ts in
I have developed a perl script which provides a menu driven functionality to allow
I have the following Perl script with is meant to indent a XML file

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.