in reply to using m// while iterating through an array

This works for me:
#!/usr/bin/perl -w use strict; chomp(my @banned_channels = <DATA>); my $channels = "#gross_people #skriptk1dd13\$ #trolls"; sub IRC::print { print "@_\n"; } foreach (@banned_channels) { if ($channels =~ /$_/i) { IRC::print "match: $_"; } } __END__ #trolls #flamers #lusers #litterbugs
However, I'd use a hash:
my $channels = "#gross_people #skriptk1dd13\$ #trolls"; my %banned; @banned{split " ", $channels} = (1); foreach (@banned_channels) { if (exists($banned{$_})) { IRC::print "match: $_"; } }