Perl snippet: unless (scalar grep { $_->{foo} eq "bar" } @$things) { Write this without…
Jump to turn (7)
- 1Perl snippet: unless (scalar grep { $->{foo} eq "bar" } @$things) { Write this w
- 2put a backslash before the dollar sign in your snippet
- 3that doesnt' seem to mean the same thing
- 4is there a way to do it without the negation operator? by rewriting the grep per
- 5can it be done without that module?
- 6any other way?
- 7any other way?
- User
Perl snippet:
unless (scalar grep { _->{foo} eq "bar" } @things) {
Write this without an unless
- Assistant
statement:
if (scalar grep { _->{foo} eq "bar" } @things) {
do nothing
} else {
code to execute when the condition is false
}
- User
put a backslash before the dollar sign in your snippet
- Assistant