I have tried with =~ m/.{30}/
but it does not seem to work under windows
activestate Perl
is this possible

If that is a question (I can't see the question mark) then the answer is no. Since others already gave examples to the effect that it does work, perhaps you should show possibly with an actual example what it is that makes you think if fails to. Without explicit code one can only make guesses and since you used the word "defined", a possible one may be that you're expecting the above to match only on a string of exactly 30 charachters. But it will match also on a longer one, because it will match a string of exactly 30 charachters on a string of 30 or more.

Another possibility could be that the string you want to match on has newlines in it, and then you will need the s modifier.

Last, without further specifications, we may suspect an XY problem here, which may not be the case, but if you say explicitly what you're after, then we could be sure.


In reply to Re^3: matching a defined lenght by blazar
in thread matching a defined lenght by harryC

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.