-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
My perl code #7
Comments
我了解了,程序要求最好是能读取任意单词表示的单位进行计算,就是要比对最合适的词确定单位的单复数来计算,这个我一开始没那么想,可以改一下实现这个功能,我现在是将一些单位及其复数形式在程序预定,然后根据读入的数据换算关系进行下边的等式计算,请问我需要修改程序文件再发回去么?谢谢 At 2013-08-05 11:18:37,ensalty [email protected] wrote: #!/usr/bin/perl } #push @re_cal,@cal;
print $1." ".$2."\n";
} — |
Hi, crazyboysk regards |
!/usr/bin/perl
open FH,'<.\input.txt';
print "[email protected]"."\n";
print "\n";
my @arr=;
my $row;
my @set;
my @Result;
my @cal;
my @re_cal;
my $max=0;
my $max_item=0;
foreach $row(@arr)
{
if($row=
/=/)/^\s*$/) #space match{
push @set,$row;next;
}
unless($row=
{
push @Result,$row;
}
}
foreach my$item (@set)
{
#@cal = split " ",$item;
#push @re_cal,@cal;
if($item =~ /1 (\S+) = (\S+) m/)
{
@cal = ($1,$2);
push @re_cal, @cal;
}
}
my @calu;
my $cal=0;
my $yu;
foreach my$item (@Result)#对行遍历
{
@calu = split " ",$item;
for(my $y=1;$y<=$#calu;$y+=3) #对等式进行遍历
{
$max = 0;
$max_item = 0;
$yu = $calu[$y-1];
$cal = $calu[$y];
The text was updated successfully, but these errors were encountered: