This does what I would like it to
if (grep {/$dn/} @ad_sys) {
$is_system = 1;
}
but this always returns 1.
if (grep $_ == $dn, @ad_sys) {
$is_system = 1;
}
What does the second piece do?
== is used for numeric comparison, if you need string comparison use eq.
It filters those elements from the list @ad_sys that are numerically equal to $dn. Then, if the result is not empty, the condition is true and the if-block is entered.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With