10.2 使用模組

模組裝好了之後,如何使用呢?

很簡單! 只要在您的 Perl 程式中加上 use 模組; 即可,如下所示:

#! /usr/bin/perl

use DBI;  # 宣告使用 DBI 模組內的所有方法

my $db="test";
my $host='localhost';
my $user='root';
my $password='ppp123';

........
........