|Perl Monk, Perl Meditation|
Re: Short or Long Handby Dietz (Curate)
|on Aug 12, 2004 at 15:25 UTC||Need Help??|
Why not just use a simple regex:
print $day, $/ if $day !~ /^0|6$/;
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!