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

Re: perl substitute

by hippo (Monsignor)
on Nov 03, 2013 at 21:27 UTC ( #1061077=note: print w/replies, xml ) Need Help??


in reply to perl substitute

Some thoughts:

  • s/foore/barstring/ works on $_ in isolation, but you're not setting $_, even implicitly.
  • You set $doc but never subsequently refer to it.
  • You use IO::File but never subsequently refer to it.
  • You alternate between slashes and hashes for regexp delimiters for no apparent reason
  • Looks like your input XML is not valid XML
  • and finally, you both use an XML parser and then attempt to just regexp your way through the string. Pick one, not both.

Replies are listed 'Best First'.
Re^2: perl substitute
by LanX (Chancellor) on Nov 03, 2013 at 21:34 UTC
    > You alternate between slashes and hashes for regexp delimiters for no apparent reason

    Well he needs another regex-delimiter an substitutions with </end> tags to avoid the slash.

    Cheers Rolf

    ( addicted to the Perl Programming Language)

      Sure, but that's no reason to alternate - just use hashes throughout. Inconsistency is the bug's friend. :)

      Thank you. This helps.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1061077]
help
Chatterbox?
[haukex]: You can put it in SOPW, but use <readmore> tags
[haukex]: Also you might want to label it "code review"
[haukex]: Unless you have specific questions, in which case SSCCE's are much better
[cbeckley]: Excellent, thank you.
[cbeckley]: CUFP is more appropriate for stuff that's finished^h^h^h^h more advanced state of completeness?

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2017-03-24 15:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (304 votes). Check out past polls.