Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Now here's the problem: when the player kills a foe called "a male elf soldier", it should turn into an item called "the corps of a male elf soldier". Therefor, I need to change the parent of this particular instance of Foe to Item.

Perhaps you'd find it easier to create a new Item, copying over the appropriate data from the Foe. That's what I'd do anyway.


In reply to Re: Change the parent of an instance by chromatic
in thread Change the parent of an instance by muba

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    [Corion]: ovedpo15: You could split on comma, and then join everything together, except the last part. Or you could match and make sure that the last part has no comma, like qr!,[^,]+$!, or you could use rindex.
    [ovedpo15]: But I don't know the length of the string. will it still work?
    [ovedpo15]: The only thing I know is that there is a comma at the end and a value after that
    [hippo]: Try it and see. Your computer won't explode.
    [Corion]: length will tell you the length of a string.
    [Corion]: But if you are parsing CSV, again, let me point to Text::CSV_XS, which you should use instead
    [hippo]: +1 for Text::CSV_XS
    [ovedpo15]: Im not allowed to use additional modules, so I can't use it. looking for a simple regex to do this task though..
    [Corion]: Ah, so this is homework? Then most likely, you should review your course material closer. It would greatly surprise me if the course material wouldn't mention the topics that will be used in the homework...

    How do I use this? | Other CB clients
    Other Users?
    Others perusing the Monastery: (10)
    As of 2018-05-27 10:39 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Notices?