Hi, my friend was helping me write my first perl script to edit a DHCP config file. I get a few errors when i try to run this script. Im running activeperl in windows for your information.
This is the script
<code>
#!/usr/bin/perl
use Socket;
open (FILE, "hosts.txt");
@ data = <FILE>;
close(FILE);
for($i=0,$i <= $#data; $i = $i+4){
($crap, $address) = split(/ /, $data[$i+2])
chop $address;
$host = gethostbyaddr($iaddr, AF_INET);
($host, $crap) = split(/./, $host);
print $data ($i);
}
</code>
these are the errors i get
syntax error at C:\perl_scripts\getip.pl line 8, near "4)"
syntax error at C:\perl_scripts\getip.pl line 13, near ");"
Execution of C:\perl_scripts\getip.pl aborted due to compilation errors.
Any info would be great. Thanks a ton.
This is the script
<code>
#!/usr/bin/perl
use Socket;
open (FILE, "hosts.txt");
@ data = <FILE>;
close(FILE);
for($i=0,$i <= $#data; $i = $i+4){
($crap, $address) = split(/ /, $data[$i+2])
chop $address;
$host = gethostbyaddr($iaddr, AF_INET);
($host, $crap) = split(/./, $host);
print $data ($i);
}
</code>
these are the errors i get
syntax error at C:\perl_scripts\getip.pl line 8, near "4)"
syntax error at C:\perl_scripts\getip.pl line 13, near ");"
Execution of C:\perl_scripts\getip.pl aborted due to compilation errors.
Any info would be great. Thanks a ton.