boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 请高手帮助几道 perl 编程题
相关主题
FB电面挂了,求指点
大家看看这几道google面试题怎么做?
问一道题
找不到合适的版面问perl的问题,在这试试,包子酬谢
Production support Position (Unix, Java, Perl and shell scripting)
找工求建议
帮人po一个programmer职位吧。
perl python shell script的工作好找吗
Job postings in SanDisk
版上有女生转cs的吗?
相关话题的讨论汇总
话题: h3话题: h4话题: foreach话题: print话题: my
进入JobHunting版参与讨论
1 (共1页)
i****5
发帖数: 6
1
1)write a perl script to merge data files with identical format based on
first field. it takes location of two or more input data files as command
line argument, merges and prints merged data to stdout.the result has to be
sorted on first field. You can assume that all data are sorted in all input
files. You are not allowed to use UNIX “sort” command. Each input tick
data file could have several hundred gigabytes. You should optimize your
solution for memory and CPU usage.
datafile1.txt
2009.12.11,ROD,12.26,90.48
2010.11.10,RKP,220.10,29.03
datafile2.txt
2009.11.11,ROD,12.26,90.48
2009.12.18,RKP,220.10,29.03
2)Writing a PERL script to find the certain pattern /zoo/ in the file and
remove the previous 2 lines including the pattern line;
The test file:
bad 1
zoo
good 1
good 2
good 3
bad 2
bad 3
zoo
good 4
good 5
good 6
bad 4
bad 5
zoo
good 7
bad 6
bad 7
zoo
good 8
3)Run the perl script below. As you will see, by changing the value in %h3,
the script also changes the value for %h4, please provide a brief
explanation. Please also provide a generalized solution for this issue.
my %h1 = ( k1 => "v1" );
my %h2 = ( k2 => \%h1 );
my %h3 = ( k3 => \%h2 );
my %h4 = %h3;
print "h3\n";
foreach my $i ( keys %h3 ) {
print "$i => $h3{$i}\n";
foreach my $j (keys %{$h3{$i}}) {
print " $j => $h3{$i}{$j}\n";
foreach my $k ( keys %{$h3{$i}{$j}}) {
print " $k => $h3{$i}{$j}{$k}\n";
}
}
}
$h3{k3}{k2}{k1} = "v2";
print "h4\n";
foreach my $i ( keys %h4 ) {
print "$i => $h4{$i}\n";
foreach my $j (keys %{$h4{$i}}) {
print " $j => $h4{$i}{$j}\n";
foreach my $k ( keys %{$h4{$i}{$j}}) {
print " $k => $h4{$i}{$j}{$k}\n";
}
}
}
多谢!
g**e
发帖数: 6127
2
家庭作业还是应该自己做

be
input

【在 i****5 的大作中提到】
: 1)write a perl script to merge data files with identical format based on
: first field. it takes location of two or more input data files as command
: line argument, merges and prints merged data to stdout.the result has to be
: sorted on first field. You can assume that all data are sorted in all input
: files. You are not allowed to use UNIX “sort” command. Each input tick
: data file could have several hundred gigabytes. You should optimize your
: solution for memory and CPU usage.
: datafile1.txt
: 2009.12.11,ROD,12.26,90.48
: 2010.11.10,RKP,220.10,29.03

b***m
发帖数: 5987
3
呵呵。不过这几个Perl题总体不难。Perl是我最喜欢的语言之一。

【在 g**e 的大作中提到】
: 家庭作业还是应该自己做
:
: be
: input

g**e
发帖数: 6127
4
维护个几十万行的perl project看看还喜欢不?写个script处理一下文本还行

【在 b***m 的大作中提到】
: 呵呵。不过这几个Perl题总体不难。Perl是我最喜欢的语言之一。
b***m
发帖数: 5987
5
哈哈哈哈,俺还真曾经开发加维护过两个,没有统计过代码量,但是都是商业级别的论
坛和综合论坛,估计几十万行没有。

【在 g**e 的大作中提到】
: 维护个几十万行的perl project看看还喜欢不?写个script处理一下文本还行
1 (共1页)
进入JobHunting版参与讨论
相关主题
版上有女生转cs的吗?
求推荐Perl script的快速入门资料,谢谢!
开贴说说SDET/STE/QA的区别和工资
data scientist职位求内推,谢谢!
变相的merge sort
一个小公司面经
re: 面试归来,上面经回馈各位战友
BB NON CS onsite面经
求一下这题解法。
question about big data
相关话题的讨论汇总
话题: h3话题: h4话题: foreach话题: print话题: my