Hi Sydney04,
The &! is not that clear but is saying that you also need a second condition that is not true. A better way of writing it is...(see note below, depending on whether you are wanting two conditions or do a logical operation).
if ( (condition1) && (!condition2) ) { }
so in your case you want $key to begin with "PERIOD_END" and you want $budget data not to be set.
Try runing the following and commenting and uncommeting the line that defines $budgetdata.. then rewrite it to the if statement I did above if you like...
#!/usr/bin/perl my $key = "PERIODEND TODAY"; #my $budgetdata = "lots of numbers"; print "Hello\n"; if ( $key =~ /^PERIODEND/ &! $budgetdata) { print "Got here\n"; } else { print "Sorry =(\n"; }

Update: I forgot to specify that I used '&&' instead of '&', with the difference being that the '&' is a bitwise operator that will do a NOT AND or NAND with the first condition as opposed to '&&' that requires two both condition 1 and condition 2. I was just splitting it.. that was to simplify...As gam3 points out though, the format of the if is probably supposed to be of format mentioned as bit twiddling on strings is not all that common, they are more likely just checking that you just don't have the budget data.


Regards Paul

In reply to Re: What does &! mean? by thekestrel
in thread What does &! mean? by sidney04

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.