I am needing to take out the first word of a sting so users can modify a score on the web. After the submit I need to put that word (what ever it may be)back into the string followed by the modified score. I don't have any idea on how to do this, Please help.
elsif ($temp =~ (m/^score/i)) { $item_line[$head_count] = $item_line[$head_count] . $& . $'; $item_line[$head_count] =~ s/score //g; ##### need something to parse out unknow word in string here. $head_count ++; $item_count = 0; } ##### writing the file ############### while($a<=$ttl) { $line_count = 0; $write_header = $tmp_headers[$a]; $write_if = $if[$a]; $write_action = $act[$a]; # Write Section Header print FILE "$write_header\n"; # Write If information print FILE "$write_if\n"; # Create item list for the individual section write_items($tmp_headers[$a]); my $t = -1; #### need to put parsed section of string back between $score and $ite +m_line while ($t++ <= $line_count) { if ($item_line[$t] ne "") { print FILE "$score$item_line[$t]\n\n"; } } $a++; }#end while

janitored by ybiC: Balanced <code> tags around code block, as per Monastery convention


In reply to take out section of a string then put it back by mr_evans2u

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, details, 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, summary, 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.