G'day perlynewby,

"question 1 I don't understand why on INDEX, the warning says $string is undef? and I also had to declare it again as "my" when I did on pragma."

When you get a error (or warning), it's vitally important that you paste it verbatim, not just type in a vague facsimile of the message.

I strongly suspect that the error you got didn't mention $string at all; instead, it made reference to $tring! (Note the missing 's'.)

So, to fix, add the 's' and remove the my (which you added).

"question 2 whys is the '~~" operator method it's not working"

That's the smart-match operator. It's experimental and subject to change. I recommend you learn non-experimental Perl before delving into ~~.

-- Ken


In reply to Re^2: find a substring of unknow lenght if it is in a hash by kcott
in thread find a substring of unknow lenght if it is in a hash by perlynewby

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.