Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Substitution don't work with a special inputfile

by Eily (Monsignor)
on Aug 24, 2015 at 12:51 UTC ( #1139673=note: print w/replies, xml ) Need Help??


in reply to Substitution don't work with a special inputfile

Your second file seems to have line breaks ("\n") in the middle of the {[%tqu...]} strings, and the dot does not match this character unless you use the /s modifier. Try s/$regex/$subst/sgi; instead

Edit: except .* with /s will be far too greedy. [^]]* or .*? would work better

Replies are listed 'Best First'.
Re^2: Substitution don't work with a special inputfile
by OldChamp (Acolyte) on Aug 24, 2015 at 15:41 UTC

    Hi Eily, thank you for your help. I have modified the code like you have suggested, but it still doesn't work.

      Yes, I forgot that you were reading line by line, so even after my modification this won't work. But as ww already told you, you have the answer to that question in your previous topic on the subject

        Hi Eily, I have read the reply of ww, but I don't understand what he means. I have applied the suggestions and I have modified my code but I can not see an answer to my question in my previous topic. As I have said, I have little experience with perl, but I have read about Regex and I thought, that this forum is a place where I can get help. But now I have the impession to be blamed for my questions. I am german and may be I don't understand every nuance of your replies. And I have never posted on the internet before, so it is possible that I did something wrong, but I think it would be polite to tell me what was wrong with my second question. For me there was a new problem, because the code worked with the first test-inputfile but not with the second one. I would appreciate an answer to this reply.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (1)
As of 2022-11-26 19:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?