I am looking for the best way to match two values at the same time.
If both values are in the string, I want to get a true value, But I don’t know the order in which they appear in the string (e.g. abcdef or bedfa, in case I want to match a and b)
Is there a better solution (especially if I need to be more complicated in the future) To match) instead of:
$string =~ m/(a.*b)|(b.*a)/i
$string =~ /a/i && $string =~ /b/i;
< /div>
I am looking for the best way to match two values at the same time.
If both values are in the string, I want to get a true value, but I don’t know the order in which they appear in the string (e.g. abcdef or bedfa, in case I want to match a and b)
Is there a better solution (especially if I need more complex ones later) Value to match) instead of:
$string =~ m/(a.*b)|(b.*a)/i
$string =~ /a/i && $string =~ /b/i;