由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - Perl: How to return 2 dimention array pls ?
相关主题
问个perl的程序perl array|hash question
怎么非ASCII字符就过滤不了呢?[Perl]请看看这个Perl random sampling code 有什么问题,
问个Perl的简单问题a question of perl
PERL问题Perl求助
perl problemjavascript
How to write "ip address => integer" in perl, python, Javascript etc. ?python Q: create array from 10 to 1
C# HtmlElement.InvokeMember at Amazon.comPerl 6 改动很大很恶心
[合集] 两个经典面题has no experience with c++, what's the logic behind the following lines? Thanks!!
相关话题的讨论汇总
话题: perl话题: dimention话题: array话题: return话题: v2
进入Programming版参与讨论
1 (共1页)
w**2
发帖数: 724
1
so i have a code like this,
foreach my $row (@lines)
{
my ($v1, $v2) = @$row;
# a lot of logics here
print $v1." ---- ".$v2."n";
}
for whatever reason, i want to reuse this piece of code for different places
,
say i have 5 lines, how to make my function return 2D array like this ?
{(1,1), (2,2), (3,3), (4,4), (5,5)}
Thanks !
e*******o
发帖数: 4654
2
http://perldoc.perl.org/perldsc.html
这本书的前几章
http://it-ebooks.info/book/879/
买本perl的书翻翻,比如这边,就几块钱。
http://www.amazon.com/Perl-Cookbook-Second-Tom-Christiansen/dp/
你想搞好Perl 这边一定要买过来。
http://www.amazon.com/Programming-Perl-Edition-Larry-Wall/dp/05
过一遍,基本上不会再有啥问题了。
Perl 那么老的语言,你能遇到的问题,基本上都讨论过了。
w**2
发帖数: 724
3
have a deadline to meet in 2 days, no time to learn, mangers won't give the
time to learn, this is my life.
a package might be better

【在 e*******o 的大作中提到】
: http://perldoc.perl.org/perldsc.html
: 这本书的前几章
: http://it-ebooks.info/book/879/
: 买本perl的书翻翻,比如这边,就几块钱。
: http://www.amazon.com/Perl-Cookbook-Second-Tom-Christiansen/dp/
: 你想搞好Perl 这边一定要买过来。
: http://www.amazon.com/Programming-Perl-Edition-Larry-Wall/dp/05
: 过一遍,基本上不会再有啥问题了。
: Perl 那么老的语言,你能遇到的问题,基本上都讨论过了。

e*******o
发帖数: 4654
4
my $arr_of_arr;
in the loop,
push @$arr_of_arr, [$v1, $v2];
at the end
return $arr_of_arr
w**2
发帖数: 724
5
多谢!

【在 e*******o 的大作中提到】
: my $arr_of_arr;
: in the loop,
: push @$arr_of_arr, [$v1, $v2];
: at the end
: return $arr_of_arr

1 (共1页)
进入Programming版参与讨论
相关主题
has no experience with c++, what's the logic behind the following lines? Thanks!!perl problem
[转载] CS Algorithm Interview questionHow to write "ip address => integer" in perl, python, Javascript etc. ?
又一道面试题,我是不是想多了?C# HtmlElement.InvokeMember at Amazon.com
Is there anything wrong with this C++ array initialization?[合集] 两个经典面题
问个perl的程序perl array|hash question
怎么非ASCII字符就过滤不了呢?[Perl]请看看这个Perl random sampling code 有什么问题,
问个Perl的简单问题a question of perl
PERL问题Perl求助
相关话题的讨论汇总
话题: perl话题: dimention话题: array话题: return话题: v2