http://qs321.pair.com?node_id=69536


in reply to Why does this happen?

You're trying to compare a scalar to an array slice (er... actually, it's not even an array slice). You have to supply just one index for the array, you can't supply several to get Perl to implicitly loop on them for you. You have to explicitly loop through the array elements, comparing each one to the input.

#!/usr/bin/perl -w use strict; print "What is your insult? "; chomp(my $input = <>); my @matching = qw/disk duck deck/; for (@matching) { if ($input eq $_) {die "bastard\n"}; }

(Updated first paragraph to be more verbose^Wclear.)

bbfu
Seasons don't fear The Reaper.
Nor do the wind, the sun, and the rain.
We can be like they are.