I thought that the forward slashes were for characters with special meaning.

Technically, the forward slashes are known as the m// operator, and anything between the delimiters (in this case slashes) is a regular expression. In a regular expression, some characters have special meaning, such as .*?, and others do not - mostly the "word" characters such as a-zA-Z0-9 and so on. Such characters are matched literally, so /not stop/ just means to look for the eight characters not stop.

if($CPC_stop_type[$i] !~ not stop){

If you're using strict, as one generally should, that's thoeretically valid Perl if you've got a sub stop - but I doubt this statement makes sense. If you're not using strict, that's valid Perl, because not is an operator and stop is taken as a so-called "bareword", but that's getting into details that probably aren't relevant here.

As for the rest of your question, sorry, but I don't understand what you are trying to do. If you want to check whether a string...

There are of course additional options - if you wanted to express "does this string contain not stop or power-off stop", you could write that as $string =~ /(?:power-off|not) stop/.

If things aren't working as you expect, then please see How do I post a question effectively? and Short, Self-Contained, Correct Example: Please provide a short, runnable piece of code that demonstrates the problems you're having, along with short but representative sample input, the expected output for that input, the actual output you're getting, including any error messages, each within <code> tags.


In reply to Re^3: Forward slashes around argument by haukex
in thread Forward slashes around argument by thnksnw

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.