Good Place for an @array. Also, changed it to return as an action with the nick of the person requesting the skittle. Added a variable for NickServ. You should not use NickServ's full mask only it's nickname.
#!/usr/bin/perl
# change values between $server and $pass
########################################################################################################################
$server = 'irc.whateverserver.com';
$port = 6667;
$nick = 'yournick';
$ident = 'yourident';
$realname = "your real name";
$chan = '#yourchannel';
$nickserv = 'NickServ';
$pass = 'yourpass';
@flavor = (
'9lime',
'6grape',
'8lemon',
'7orange',
'12raspberry',
'5wild cherry',
'5berry punch',
'3melon berry',
'8banana berry',
'9kiwi lime',
'7mango tangelo',
'11pineapple passionfruit',
'4strawberry starfruit',
'8lemon berry',
'14mixed berry',
'13peach pear',
'7orange mango',
'13strawberry banana',
'5chocolate',
'4strawberry',
);
use IO::Socket;
$irc=IO::Socket::INET->new(PeerAddr=>"$server:tcp($port)");or die "DEAD!\n";
print $irc "NICK $nick\n"; print $irc "USER $ident 8 * :$realname\n";
print $irc "PRIVMSG $nickserv :identify $pass\n"; print $irc "join $chan\n";
print "$nick has connected to $server on $chan\n";
while(defined($in = <$irc>)){
if($in =~ /^PING(.*)/) { print $irc "PONG :$1\n" }
print "$in\n";
if($in =~ /^:(.+)!.+ PRIVMSG $chan :!skittles?\r$/) {
print $irc "PRIVMSG $chan :\x01ACTION gives a \x03".$flavor[int(rand @flavor)]."\x03 skittle to $1\x01\n";
}
}
close($irc);