How do I…

How do I get data from a database?

DBI,and its DBD children,like DBD::SQLite

How do I get data from a web page?

LWP stands for "libwww-perl",and is the standard way of talking to web pages.

WWW::Mechanize is a superset of LWP that makes HTML processing easier.

How do I do date calculations?

Use Date::Manip,Date::Calc or DateTime.All have different styles and different capabilities.

How do I handle command-line arguments in my program?

Use Getopt::Long.

How do I write CGI programs?

Use CGI.

How do I parse HTML?

Whatever you do,don't use regular expressions.Use HTML::Parser or one of the many classes that uses it.Look around on http://search.cpan.org.

If you're parsing HTML so that you can extract links or images from a web page,use WWW::Mechanize which handles it for you.

How do I parse XML?

See the list of Recommended XML Modules at the Perl 5 wiki.

http://www.perlfoundation.org/perl5/index.cgi?recommended_xml_modules

How do I know if a URL is valid?

How do I do screen access?

How do I do colors?

Use Term::ANSIColor.Example wanted.

How do I do readkey?How do I enter passwords without seeing them entered?

Use Term::ReadKey (http://search.cpan.org/dist/TermReadKey).It's a standard core module.

  1. use Term::ReadKey;
  2.  
  3. ReadMode('noecho');
  4. my $passwd;
  5. my $pwcheck;
  6.  
  7. print 'password: ';
  8. chomp($passwd = <STDIN>);
  9. print "\n";
  10.  
  11. print 'verify: ';
  12. chomp($pwcheck = <STDIN>);
  13. print "\n";
  14. ReadMode('normal');
  15.  
  16. print "You entered [$passwd] and [$pwcheck]\n";

Want to contribute?

Submit a PR to github.com/petdance/perl101