Do you know where your variables are? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Why not just use a simple regex:
print $day, $/ if $day !~ /^0|6$/; Add: I made a common beginner mistake and I feel really ashamed about it. Although above code will work on a single digit as it was demanded ( $day representing a weekday field from localtime() ) it is not logic as it says: don't match 0 at the beginning or don't match 6 at the end. With nonmatching parens ( !~ /^(?:0|6)$/ ) it will satisfy the logic, still matching nondigits though. So it would've even been better written as !~ /0|6/ since the expected data is a single digit. I'm so sorry! In reply to Re: Short or Long Hand
by Dietz
|
|