Several remarks to begin:
1) Learn to use pragmas strict and warnings from the outset that you will forge a way to program cleaner.
To indicate the beginning of the script:
Code:
#! /usr/bin/perl -w
use strict;
use warnings;
2) Your loop seems incomplete. Unless it finished changing, there are 3 conditions in a loop: initialization, loop end, increment.
Your loop should it not be rather:
Code:
for ($i = 0; $i < $v; ++$i)
?
3) The semicolon is missing at the end of this line:
Code:
open (FIC, ">>/usr/local/nagios/etc/objects/network.cfg")
4) I do not understand why you open 50 times the same file, why you write anything in it and why you use the printf function while print seems easier to use (especially here).
Bookmarks