The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 03-18-2008
zx1106 zx1106 is offline
Registered User
  
 

Join Date: Mar 2008
Location: U.S.
Posts: 21
[B]"redo" in perl[/B]

I knew this would not work because of problem with "redo". Is there a way to fix this? Thanks a lot!


Code:
my @n = (10..100);
my $i;
my $j = 0;
my $k;

LINE1: for ($i; $i < 10; $i++) {
   $k = $n[int rand @n];
   $j += $k;
}

if ( ((550 - $j) < 10) || ((550 - $j) > 100) ) {
   redo LINE1; 
}

Last edited by zx1106; 03-18-2008 at 06:51 PM.. Reason: added code tags