The Roopak Times wrote:
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
Those aren't the errors I'm getting from your code.
Check your work again....
You have several variable errors in addition to the very first line is also in
error.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>