Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Comparing multiple strings

by Eily (Monsignor)
on Jan 15, 2019 at 16:50 UTC ( [id://1228602]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @invalid_list = qw< John Simon Mathias Aerith Bob >;
    my @test = qw< Alice Bob John Doe >;
    
    ...
    {
      print "$name\n" unless exists $invalid{$name};
    }
    
  2. or download this
    use List::Util qw( none all any );
    for my $name (@test)
    {
    ...
      print "Any  > $name\n" unless any { $name eq $_ } @invalid_list;
      print "All  > $name\n" if all { $name ne $_ } @invalid_list;
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1228602]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-25 14:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found