Quote:
Originally Posted by ownedbycats
Code:
if $rating ==# 0 && $#fanficstatus != '(In-Progress|Abandoned)' && $#vls !='Documentation & Manuals' then
'rating.png'
The In-Progress|Abandoned bit failed to work. How do I set "if it does not match this regex"?
|
The != operator is precisely that: case-sensitive not equals. It doesn't take a regex.
If you want to use a regex then you should use the 'in' operator. Because you want it negated, use
Code:
! ('^(In-Progress|Abandoned)$' in $#fanficstatus)
Alternatively use
Code:
($#fanficstatus != 'Abandoned' && $#fanficstatus != 'In-Progress')
or
Code:
! ($#fanficstatus == 'Abandoned' || $#fanficstatus == 'In-Progress')
To understand the difference between the above two expressions see a description of
De Morgan's Law.
Quote:
Also, #vls should be an inlist. How do I set a "is not inlist"?
|
Use the '!' operator, e.g.,
Code:
! ('^Documentation & Manuals$' inlist $#vls)
The parentheses are there to avoid problems with operator precedence. You want to be sure that the '!' applies to the result of 'inlist' instead of 'Documentation & Manuals'. In fact the precedence of '!' is lower than the comparison operators (executes after them) but using parenthesis to state your intent is always a good idea.
I wonder if you shouldn't sign up to an Intro to Computer Science course.