f**c 发帖数: 629 | 1 【 以下文字转载自 JobHunting 讨论区 】
发信人: flac (fish), 信区: JobHunting
标 题: Help: a Perl script question, Thanks
发信站: BBS 未名空间站 (Fri Feb 29 00:50:35 2008)
assuming the following database table:
create table userinfo (
id int not null primary key auto_increment,
username varchar(12) not null,
salary int not null
);
And assume that using Perl DBI, you can access the database with:
use DBI;
my $drh = DBI->install_driver("mysql");
my $dbh = DBI->connect( "DBI:my | T*****e 发帖数: 361 | 2 Execute the SQL call with an "order by" clause to solve (a), and save a copy
of all records in memory while printing the sorted records. An array of
array references will do.
Use "sort" function with a code block to sort the records according to
username/salary for (b) and (c). |
|