PhillipHuang has asked for the wisdom of the Perl Monks concerning the following question:
and now have some problem with my sub partition, pls see codes below:1 11 121 1331 14641 .......
and when run it at command line,#!/usr/bin/perl use strict; use warnings; my $i; my $j; my $k; my @a; my @b; $a[0] = 1; $a[1] = 1; for($i=0;$i<=10;$i++){ @a = &yh(@a); print @a,"\n"; } sub yh{ my(@a)=@_; my @b; my $j; my $k; $k = $#a + 1; $b[0] = 1; for($i=1;$i<=$k;$i++){ $j = $i - 1; $b[$i] = $a[$i] + $a[$j]; } $b[$k] = 1; return @b; }
I know i can ignore the warning by remove "use strict and use warnings". while my question is ,if i want to remain "use strict" "use warnings" in codes, what can i do to not display this warning message? Thanks, Phillipphillip@Athen:~/script$ perl yanghui.pl Use of uninitialized value in addition (+) at yanghui.pl line 34. 121 Use of uninitialized value in addition (+) at yanghui.pl line 34. 1331 Use of uninitialized value in addition (+) at yanghui.pl line 34. 14641 Use of uninitialized value in addition (+) at yanghui.pl line 34. 15101051 Use of uninitialized value in addition (+) at yanghui.pl line 34. 1615201561 Use of uninitialized value in addition (+) at yanghui.pl line 34. 172135352171 Use of uninitialized value in addition (+) at yanghui.pl line 34. 18285670562881 Use of uninitialized value in addition (+) at yanghui.pl line 34. 193684126126843691
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem in my sub partition
by Ratazong (Monsignor) on Nov 08, 2010 at 16:12 UTC | |
|
Re: problem in my sub partition
by kcott (Archbishop) on Nov 08, 2010 at 16:19 UTC | |
|
Re: problem in my sub partition
by moritz (Cardinal) on Nov 08, 2010 at 16:16 UTC | |
|
Re: problem in my sub partition
by VinsWorldcom (Prior) on Nov 08, 2010 at 16:09 UTC | |
by GrandFather (Saint) on Nov 10, 2010 at 00:33 UTC | |
|
Re: problem in my sub partition
by jethro (Monsignor) on Nov 08, 2010 at 16:20 UTC | |
|
Re: problem in my sub partition
by Anonymous Monk on Nov 08, 2010 at 17:13 UTC | |
|
Re: problem in my sub partition
by Fletch (Bishop) on Nov 08, 2010 at 20:09 UTC | |
|
Re: problem in my sub partition
by poolpi (Hermit) on Nov 09, 2010 at 08:54 UTC | |
|
Re: problem in my sub partition
by GrandFather (Saint) on Nov 10, 2010 at 00:50 UTC |