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 7875553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:00:06+00:00 2026-06-03T03:00:06+00:00

as a not Perl programmer, i would like to be sure i had well

  • 0

as a not Perl programmer, i would like to be sure i had well understood a construct that i am going to port to Python,

when using :

if (s/^([$PChar])(.)/$2/) {
  print $1,"\n";
  $finished = 0;
}
  • $1, $2 etc. are matching regular expression
  • s/search for/replace with/

what i am really not sure is does the matching/replacement is done before the print $1 ? and is it done “inplace” inside current buffer (which is $F, that is $_ line by line readed, splitted on its space character), that is changing it (so if i understand well, the ([$PChar]) when @ beginning of a string is totally striped off/lost in the above statment) ?

EDIT : no maybe it is not lost, first parenthesis part is captured, and then printed as $1 + new line character and then… no, do not understand what become $2… may be buffer change to second parenthesis part ? /END OF EDIT.

also is there any environnement or what is the best environnement that permit to do some step-by-step debugging on Win platform ? i’m aware that having this, i will not have asked this question. And i do not need to learn Perl, just only to be able to read and adapt this script.

here is the englobing part :

@F = split;
for( $j=0; $j<=$#F; $j++) {
  my $suffix="";
  $_ = $F[$j];
  # separate punctuation and parentheses from words
  do {
$finished = 1;
# cut off preceding punctuation
if (s/^([$PChar])(.)/$2/) {
  print $1,"\n";
  $finished = 0;
}
# cut off trailing punctuation
if (s/(.)([$FChar])$/$1/) {
  $suffix = "$2\n$suffix";
  $finished = 0;
}

whole script tokenize.pl can be seen here while original tar.bz if from here

best regards

  • 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-03T03:00:08+00:00Added an answer on June 3, 2026 at 3:00 am
    # try to delete the first character from the string contained in
    # $_ if that character is one of the characters contained in
    # the string $PChar. The deletion is done by replace the first and
    # second character by only the second character.
    if (s/^([$PChar])(.)/$2/) {
    
      # if the replacement was successful, print the deleted character.
      print $1,"\n";
      $finished = 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not a perl programmer but need to debug an error. I'm using the
Preferably using a scripting language like Perl or Python, but if I have to
Not sure if this counts as programming related, it's a tool that I use.
I'm a Perl programmer who's attempting to learn Python by taking some work I've
I am ok with regular expressions in Perl but not had to do it
I am going to spend 30 minutes teaching Perl to an experienced programmer. The
I'm a Perl programmer with some nice scripts that go fetch HTTP pages (from
So I am a beginning Perl programmer. I have been using it for about
I'm guessing it's not a Perl Compatible Regular Expression, since there's a special kind
I'm building a regression system ( not unit testing) for some Perl scripts. A

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.