imperl has asked for the wisdom of the Perl Monks concerning the following question:
And Prasad, sorry if I asked. Ive got a ton to do, in a short period of time, with my limited knowledge of perl. I always try before I ask. Thanks anyways... The next time you see me around, dont bother ok!print ("Enter the number of XML files required to be created:"); $number=<STDIN>; print ("\nEnter the name of the XML file:"); $file_name=<STDIN>; chomp($file_name); $xml=".xml"; $" = ':'; for ($i=1; $i<=$number; $i++) { $files="$file_name$i$xml"; open(FILE, ">$files") or die "Can't open the file: $i\n"; $first="SCS"; $leading = sprintf("%07d", $i); $firstname="$first$leading"; print FILE "\n <firstname>$firstname</firstname> "; $mac = sprintf("%012d", $i); @split = ($mac =~ /../g); $ip=sprintf("192168%06d",$i); @splitip= ($ip =~ /.../g); @splitipfinal= join('.', @splitip) . "\n"; print FILE "\n <name>NEW - @split</name> "; print FILE "\n <ipaddress>@splitipfinal</ipaddress> "; } print "\nThe XMLs have been created, check in the same directory!!";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: IP address generation
by Fletch (Bishop) on May 24, 2005 at 12:18 UTC | |
|
Re: IP address generation
by demerphq (Chancellor) on May 24, 2005 at 12:25 UTC | |
|
Re: IP address generation
by moot (Chaplain) on May 24, 2005 at 14:12 UTC | |
|
Re: IP address generation
by castaway (Parson) on May 24, 2005 at 11:54 UTC | |
|
Re: IP address generation
by holli (Abbot) on May 24, 2005 at 12:10 UTC | |
|
Re: IP address generation
by blazar (Canon) on May 24, 2005 at 12:02 UTC | |
|
Re: IP address generation
by prasadbabu (Prior) on May 24, 2005 at 12:03 UTC |