ptanswer - 2009/6/4 http:/xfzhou.homeftp.org/courses a)x...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
模拟考卷解答 一、是非题 a)x b)v c)x d)x e)x f)x g)x h)x i)x j)x k)v l)x m)x n)v o)x p)x q)x 二、选择题 a)1 b)5(1,0,undef) c)1 d)2 e)1 f)24 g)45 h)3 i)24 j)234 三、填空题 a)map int rand $a, 1. .10 b) my $this = shift; my $name = $AUTOLOAD; $name =~ s!.*:!!; # remove package_name:: return undef unless exists $this->{$name}; $this->{$name} = shift if (@_); $this->{$name}; 四、编程题 #!/usr/bin/perl -w use strict; ################### # part 1 open F, "star25.txt" or die "Can't open file"; my @lines = <F>; close F; chomp @lines; s/#.*// foreach @lines; my (%sname, %spectrum, @fields); foreach (grep !/^$/, @lines) { @fields = split /:/, $_; next if @fields < 6; $sname{$fields[0]} = $fields[1]; $spectrum{$fields[0]} = $fields[5]; } print exists $sname{$_} ? 2009/6/4 http://xfzhou.homeftp.org/courses…
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/27/2011 for the course CS Perl taught by Professor Guo during the Spring '09 term at Xiamen University.

Page1 / 2

ptanswer - 2009/6/4 http:/xfzhou.homeftp.org/courses a)x...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online