Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Trim Two Characters On Line

by AnomalousMonk (Archbishop)
on Oct 23, 2020 at 04:26 UTC ( [id://11123072]=note: print w/replies, xml ) Need Help??


in reply to Re: Trim Two Characters On Line
in thread Trim Two Characters On Line

$line =~ s/(SUM.*)(..)/$1/
This does not seem to meet jalopez453's requirement. The strings 'SUMx' and 'SUM' both contain the substring 'SUM' and so should truncate to 'SU' and 'S' respectively, but do not.

Also, I don't understand how the sequence of operations

DB<1> $_ = 'abcSUXcdexx' DB<2> s/(SUM.*)(..)/$1/ DB<3> p abcSUMcde
comes about. A typo?


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^3: Trim Two Characters On Line
by LanX (Saint) on Oct 23, 2020 at 08:07 UTC
    Oh, I get your point. But that's how I understood the question.

    The OP should clarify.

    But you're right the pseudo code says otherwise.

    > A typo?

    Kind of, a side effect of the default page editing/cursor mode when I use the perldb inside emacs.

    Thanks fixed! :)

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11123072]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (None)
    As of 2024-04-25 00:51 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found