(1) For example,
use strict;
#
# t1aq1.pl inputfilename
#
# Read in input file data.
@ARGV < 1 && die "Error, usage:
t1aq1.pl inputfilename.";
open(IN, $ARGV[0]) || die "Can't open file
$ARGV[0].";
my @lines = <IN>;
my %counts = (); # Storing counts of quotes.
# Populate %counts with input
data.
my $FAMILY = "ani|ins|pla";
my $body = join "", @lines;
$body =~ s/\n/ /g;
while ($body =~ /($FAMILY)\s*(\d+)\s*,\s*(\d+)/gi)
{
$counts{$1. " " . $2 . "," .
$3}++;
}
# Print out %counts.
foreach (sort keys %counts) {
print "$_: $counts{$_}.\n";
}
exit 0;
(2) 3
(3) For example,
use strict;
use CGI qw/:standard/;
use Win32::ODBC;
#
# s00t1aq3.pl
#
# Author: Kwok-Bun Yue March
4, 2000
#
# A CGI program to search the
database
# s00t1aq3(QuoteId, Family, Volume,
Page, QCount)
# and return the total quote
counts in a given
# family and volume.
#
# Change these parameters for
porting.
my $DSN = "test";
# Open the DSN
my $db = new Win32::ODBC($DSN) || die "Can't
open DSN $DSN.\n";
# Get the parameters.
my $family = param('family');
my $volume = param('volume');
my $sql = "select sum(QCount) as total from
s00t1aq3 where Family = '$family' and Volume = $volume";
$db->Sql($sql);
my $result = "";
$db->FetchRow();
my %Data = ();
%Data = $db->DataHash();
if ($Data{'total'} > 0) {
$result = "There are " . $Data{'total'}
.
" quotes in the family $family and volume $volume.";
}
else {
$result = "There is no quote
in the family $family and volume $volume.";
}
print header,
start_html("Biological
Quotes"),
$result,
end_html;
exit 0;
(4) For example,
Whenever I <span style="color:#CCFFFF;font-style:italic;font-family:Arial>feel</span> blue, I eat an apple.
(5) For example,
<HEAD>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--- Hide script from old browsers
function compute(f) {
f.square.value = f.number.value
* f.number.value;
f.cube.value = f.square.value
* f.number.value;
}
// end hiding from old browsers -->
</SCRIPT>
</HEAD>
<BODY>
<FORM>
Enter an integer:
<INPUT TYPE="text" NAME="number" SIZE=15
onChange="compute(this.form)">
<BR>
<INPUT TYPE="button" VALUE="Compute" onClick="compute(this.form)">
<P>
Square: <INPUT TYPE="text" NAME="square"
SIZE=15 >
<BR>
Cube: <INPUT TYPE="text" NAME="cube" SIZE=15
>
</FORM>
</BODY>