文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Example Perl Program

Example Perl Program

时间:2010-01-23  来源:admin126com

Example Perl Program

#!/usr/bin/perl

use DBI;

use strict;

my $conn = DBI->connect("dbi:Pg:dbname=test");

my ($first_name, $last_name, $hired_at);
my (@row);

$conn->do("SET DateStyle = 'European'");

my $query = $conn->prepare(
    "SELECT first_name, last_name, hired_at" .
    " FROM employees" .
    " ORDER BY last_name, first_name"
    );
$query->execute();

print sprintf("%-40s%-20s", "Name:", "Hired At:"), "\n";
print "-" x 60 . "\n";
while (@row = $query->fetchrow_array())
{
    ($first_name, $last_name, $hired_at) = @row;

    print sprintf("%-40s%-20s", $first_name . " " . $last_name, $hired_at),
        "\n";
}

undef($query);
$conn->disconnect();
$conn = undef;
相关阅读 更多 +
排行榜 更多 +
pvz金铲铲版下载

pvz金铲铲版下载

策略塔防 下载
跳舞的线无尽版游戏下载

跳舞的线无尽版游戏下载

休闲益智 下载
西电睿思手机版app下载

西电睿思手机版app下载

生活实用 下载