----- Original Message -----
From: [EMAIL PROTECTED]
Date: Thursday, January 19, 2006 3:19 pm
Subject: Nested Loop
> Greetings,
Hello
>
> Basically I deleted a portion of a mysql database and need to
> insert the
> subnet back in. The output is suppose to increment the first
> field
> starting with '8' until the IP is 10.168.17.255. I can't figure
> out my
> inside loops condition.
You have a Typo Sir.
>Maybe there is a perl module for this?
>
>
> Example:
>
> > INSERT INTO `anyInventory_values` VALUES (8,1,'10.168.17.0');
> > INSERT INTO `anyInventory_values` VALUES (8,2,'Unknown');
> > INSERT INTO `anyInventory_values` VALUES (8,3,'');
> > INSERT INTO `anyInventory_values` VALUES (8,4,'');
> > INSERT INTO `anyInventory_values` VALUES (8,5,'');
> > INSERT INTO `anyInventory_values` VALUES (8,6,'');
> > INSERT INTO `anyInventory_values` VALUES (8,7,'');
> > INSERT INTO `anyInventory_values` VALUES (8,8,'Unknown');
> > INSERT INTO `anyInventory_values` VALUES (8,9,'');
> > INSERT INTO `anyInventory_values` VALUES (8,10,'');
> > INSERT INTO `anyInventory_values` VALUES (8,14,'');
> > INSERT INTO `anyInventory_values` VALUES (9,1,'10.168.17.1');
> > INSERT INTO `anyInventory_values` VALUES (9,2,'Unknown');
> > INSERT INTO `anyInventory_values` VALUES (9,3,'');
> > INSERT INTO `anyInventory_values` VALUES (9,4,'');
> > INSERT INTO `anyInventory_values` VALUES (9,5,'');
> > INSERT INTO `anyInventory_values` VALUES (9,6,'');
> > INSERT INTO `anyInventory_values` VALUES (9,7,'');
> > INSERT INTO `anyInventory_values` VALUES (9,8,'Unknown');
> > INSERT INTO `anyInventory_values` VALUES (9,9,'');
> > INSERT INTO `anyInventory_values` VALUES (9,10,'');
> > INSERT INTO `anyInventory_values` VALUES (9,14,'');
> ...
>
>
>
> My Runaway Perl Script:
>
>
> $file = 'out.sql'; # sql script
> open(INFO, ">$file"); # open for output
>
>
> for($x=0;$x<=255;$x++){
>
> for($n=8;$n+1;$n++){
There is no terminated condition here, you probably wanted to say
for($n=1;$n<=8;$n++){
Alternative would be
for my $n (1...8){
>
> print INFO "INSERT INTO \`anyInventory_values\` VALUES
> ($n,1,'10.168.17.$x')\;\n";
> print INFO "INSERT INTO \`anyInventory_values\` VALUES
> ($n,2,'Unknown')\;\n";
> print INFO "INSERT INTO \`anyInventory_values\` VALUES
> ($n,3,'')\;\n";
> print INFO "INSERT INTO \`anyInventory_values\` VALUES
> ($n,4,'')\;\n";
> print INFO "INSERT INTO \`anyInventory_values\` VALUES
> ($n,5,'')\;\n";
> print INFO "INSERT INTO \`anyInventory_values\` VALUES
> ($n,6,'')\;\n";
> print INFO "INSERT INTO \`anyInventory_values\` VALUES
> ($n,7,'')\;\n";
> print INFO "INSERT INTO \`anyInventory_values\` VALUES
> ($n,8,'Unknown')\;\n";
> print INFO "INSERT INTO \`anyInventory_values\` VALUES
> ($n,9,'')\;\n";
> print INFO "INSERT INTO \`anyInventory_values\` VALUES
> ($n,10,'')\;\n";
> print INFO "INSERT INTO \`anyInventory_values\` VALUES
> ($n,14,'')\;\n";
>
> }
> }
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>