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

Re: Why does this happen?

by $code or die (Deacon)
on Apr 04, 2001 at 07:42 UTC ( #69540=note: print w/replies, xml ) Need Help??

in reply to Why does this happen?

Update: This is bad advice - It doesn't work. See merlyn reply below.

This works on my system:
use strict; print "What is your insult? "; chomp(my $input = <>); my @matching = qw/disk duck deck/; if ($input eq $matching[0||1||2]) {die "bastard\n"};

$ perldoc perldoc

Replies are listed 'Best First'.
Re: Re: Why does this happen?
by merlyn (Sage) on Apr 04, 2001 at 08:32 UTC
    if ($input eq $matching[0||1||2]) {die "bastard\n"};
    which means exactly the same as:
    if ($input eq $matching[1]) {die "bastard\n"};
    Were you expecting it to mean something different, especially since you said it "works"? In what manner did you mean "works"?

    -- Randal L. Schwartz, Perl hacker

      ahh - I only tested it with $matching[1]. Oops. /me goes red!

      The lesson is... test, test, test - especially if you do something like I did that you've never seen anyone else do (usually for good reason!)

      $ perldoc perldoc
    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2022-01-29 08:39 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (74 votes). Check out past polls.