hi monks when i run the following script
it gives "Month '12' out of range 0..11 at dhcp.pl line 20" error...i don't understand what that error means properly please help me out to solve the problem...thanks in advance..#!/usr/bin/perl $now = time(); use Time::Local; open(LEASE, "/var/lib/dhcp3/dhcpd.leases"); foreach $line (<LEASE>) { chomp($line); $data = 1 if $line =~ /^lease /; $data = 0 if $line =~ /^}/; if ($data) { if ($line =~ /^lease/) { $ip = (split(" ", $line))[1]; } elsif ($line =~ /^ starts/) { ($date, $time) = (split(" ", $line))[2,3]; ($y, $m, $d) = split("/", $date); ($H, $M, $S) = split(":", $time); $start = timelocal($S,$M,$H,$d,$m,$y); } elsif ($line =~ /^ ends/) { ($date, $time) = (split(" ", $line))[2,3]; ($y, $m, $d) = split("/", $date); ($H, $M, $S) = split(":", $time); $stop = timelocal($S,$M,$H,$d,$m,$y); } elsif ($line =~ /^ hardware ethernet/) { $mac = (split(" ", $line))[2]; $mac =~ s/;//; } elsif ($line =~ /^ client-hostname/) { $client = (split(/\"/, $line))[1]; } } else { print localtime($start) . "\t" . localtime($stop) +. "\t$ip\t$mac\t$client\n" if $stop >= $now; $ip = ""; $start = ""; $stop = ""; $mac = ""; $cli +ent = ""; } } close(LEASE);
In reply to time local module by varalaxmibbnl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |