Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^8: simplifying substitution

by Polyglot (Friar)
on Mar 08, 2021 at 15:57 UTC ( #11129343=note: print w/replies, xml ) Need Help??

in reply to Re^7: simplifying substitution
in thread simplifying substitution

Maybe the context affects it? Command line operation different? In any case, I wasted three+ hours today because I'd neglected to replace a space character with a "\s" in one of my matches. It was just a space, too...not a tab, return, or anything else. It was an HTML tag of the form <span class=" body"> and I had only put the \s in one of the two spaces....ooops. Three hours for a space. It really doesn't help to have folk like yourself tell me that it wasn't supposed to happen that way. Ha. So, can you tell me why perl is so fickle?

And, no, I'm not planning to upgrade it. Too much work and too much risk with all I've got going.

EDIT: I just realized what it must have been. I just re-read your earlier post, and you mentioned "without the /x"...well, I would have been using the /x. That must have been the crucial bit here.



Replies are listed 'Best First'.
Re^9: simplifying substitution
by choroba (Archbishop) on Mar 08, 2021 at 16:02 UTC
    > folk like yourself tell me that it wasn't supposed to happen that way

    If you could share a demonstration of your claims, I'd be happy to investigate it. I'm trying to help you, and I'd be glad if I educated myself along the way.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      I think I'm the one who just got educated. I set up a test and confirmed that the spaces are matched unless the /x flag is used. I may have known about that once in the distant past but had forgotten it. I believe I'll remember this better from now on!

      Thanks for your promptings.



Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (1)
As of 2021-09-26 14:03 GMT
Find Nodes?
    Voting Booth?

    No recent polls found