in reply to regex and getpwent()...
You could, of course, keep the other two regexes separate:if ($shell ne "" and $shell !~ /false|null/) { # it's ok }
Also, the pattern // does NOT match empty strings -- it uses the last matched pattern again:if ($shell ne "" and $shell !~ /false/ and $shell !~ /null/) { # it's ok }
To match empty strings, either use /^$/ or /^\z/, depending on your definition of empty."foo" =~ /foo/; print grep //, qw( bar foobar ); # foobar
|
|---|