Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Why does this happen?

by strredwolf (Chaplain)
on Apr 04, 2001 at 11:43 UTC ( #69574=note: print w/replies, xml ) Need Help??


in reply to Why does this happen?

There's a few problems, which some have touched on. However, what if I typed in a sentence for an insult? It wouldn't match if I used "disk" in a sentence, eh?

Try this instead:

#!/usr/bin/perl -w use strict; print "What is your insult? "; chomp(my $input = <>); my @matching = qw/disk duck deck/; foreach $j (@matching) { die "bastard\n" if($input =~ /$j/); }
Hmmm... can't we precompile these three items, incase they're used often?

--
$Stalag99{"URL"}="http://stalag99.keenspace.com";

Replies are listed 'Best First'.
Re: Re: Why does this happen?
by grinder (Bishop) on Apr 04, 2001 at 12:36 UTC

    You could compile them into a regexp with

    my $re = do { local $"='|'; qr/^(?:@matching)$/ };

    --
    g r i n d e r

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2022-01-28 00:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (72 votes). Check out past polls.

    Notices?