Franck69 has asked for the wisdom of the Perl Monks concerning the following question:
################################################# #FIRST TEST $i = 0; $j = 0; $k = 0; @data = (); for ($i=0; $i<=3; $i++){ $data[$i] = "group $i"; for ($j=0; $j<=3; $j++){ $temp1 = $j+$i+10; $data[$i][$j] = "user $temp1"; for ($k=0; $k<=3; $k++){ $temp2 = $k+100; $data[$i][$j][$k] = " $temp2"; } } } for ($i=0; $i<=3; $i++){ print "\n\n$data[$i] own: "; for ($j=0; $j<=3; $j++){ print "\n $data[$i][$j] who have privilege "; for ($k=0; $k<=3; $k++){ print "$data[$i][$j][$k],"; } } } ################################################# ################################################# #SECOND TEST use strict; use warnings; my $i = 0; my $j = 0; my $k = 0; @::data = (); my $temp1; my $temp2; for ($i=0; $i<=3; $i++){ $::data[$i] = "group $i"; for ($j=0; $j<=3; $j++){ $temp1 = $j+$i+10; $::data[$i][$j] = "user $temp1"; for ($k=0; $k<=3; $k++){ $temp2 = $k+100; $::data[$i][$j][$k] = " $temp2"; } } } for ($i=0; $i<=3; $i++){ print "\n\n$::data[$i] own: "; for ($j=0; $j<=3; $j++){ print "\n $::data[$i][$j] who have privilege "; for ($k=0; $k<=3; $k++){ print "$::data[$i][$j][$k],"; } } } #################################################
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl multidimensional arrays with "use strict"
by Joost (Canon) on Jun 15, 2004 at 19:40 UTC | |
Re: Perl multidimensional arrays with "use strict"
by Aragorn (Curate) on Jun 15, 2004 at 19:47 UTC | |
by Anonymous Monk on Jun 15, 2004 at 20:13 UTC |