================================================================================ Creating a DiceBot In our first lesson, we'll create an IRC bot that rolls the dice for you. Copy the code for dicebot.pl to your home folder: $ cp dicebot.pl ~/dicebot.pl Next, open up dicebot.pl using a text editor and make a few changes. (We recommend vim because it provides syntax highlighting) 1. Edit the server in line 20. Replace irc.example.com with the server's real address. NOTE: Only IPv4 is supported. 2. Edit line 23 to replace nickname with the nickname you want for the bot. WARNING: The nickname must not already be taken, or else the bot will fail to connect. 3. Edit line 24 to replace username with the username you want for the bot. The username is what appears in a /whois on IRC; it can be different from the nickname. Next, you'll want to make the perl script executable: $ chmod u+x ~/dicebot.pl Then run the script: $ perl ~/dicebot.pl On IRC, /join #perl101 Type !roll and you'll see the bot rolls a pair of virtual dice. In less than 5 minutes, you've created your first IRC bot with perl. ================================================================================ Understanding DiceBot Next, take a look at the file called ~/comments to see an explanation of key lines in the program. ================================================================================