Hi All

how can i run a batch file by a perl script.
i'm also getting a compilation error in following program. i have output of
ping commnad in a text file and i want to replace the IP Address with the
hostname.

error is:-
Global symbol "%sites " requires explicit package name at network.pl line
25.


#!usr/bin/perl
use warnings;
use strict;

#OPEN THE THE FILE "Check.txt" AND REPLACE IP ADDRESS WITH SITE NAMES

our %sites=(
  '172.16.8.8', "hostname1",
  '172.16.1.8', "hostname2",
  '172.16.4.8', "hostname3",
  '172.16.16.8', "hostname4"
   );

my $i;

open CHECK, ">>'Check.txt'" or die $!;
 while (<CHECK>)
  {
  for  $i (keys %hash)
  {
$_ =~ (s/$i/$hash[$i]/g);
  print CHECK $_;
  }
}

--
Thankx & Regards

Roopak Kr Prajapat

Reply via email to