I am trying to understand the following code:
[code=perl] my @arr1=(5,3,2,1, 4);
my $i=0;
my $j=0;
$tmpnum
for($i=0;$i<@ar r1;$i++) {
for($j=0;$j<@ar r1;$j++) {
if($arr1[$i]<$arr1[$j]) {
$tmpnum=$arr1[$i];
$arr1[$i]=$arr1[$j]
$arr1[$j]=$tmpnum;
};
};
};
foreach(@arr1) {
print $_...
User Profile
Collapse
-
Newbie trying to understand nested loops
-
Data Manipulation with pop, push, and shift.
My instructor has asked me to use the pop, shift, and push functions to write a script that sufficiently "shuffles" a simulated deck of cards before printing the top five cards.
I came up with the following code but the problem I am having is that I can't seem to shuffle by just using pop, push, and shift. I think the problem for me is trying to understand what constitutes a shuffle because there are many different ways to...
No activity results to display
Show More