Dax Games wrote:
> Why don't I Get IP addresses in the IP Address column of the report 
> below.  The data is there if I do a print after the split of the value 
> in %GAA_Up.  I get:

PS: I see no need for using format for this report - (s)printf should suffice.

Always supply a runnable test case:

use strict;
use warnings;

my $GS_Report = '/tmp/foo';

my %GAA_Up = (
   1.2.3.4 => "ROOSEVELT FIELD\t1.2.3.4\tUP\tTue May  8 13:54:57 2007",
   1.2.3.5 => "FASHION\t1.2.3.5\tUP\tTue May  8 13:55:25 2007",
   1.2.3.6 => "WESTMINSTER, CA\t1.2.3.6\tUP\tTue May  8 13:55:16 2007",
);
my ($GS_Location, $GS_IPAddr, $GS_UP, $GS_Time);

UpReport ();
exit;

sub UpReport {

print "Running Up Report....\n";

my ($LS_FORMAT_NAME, $LS_FORMAT_TOP_NAME); # , $LS_Location, $LS_Time);

select ((select (STDOUT), $LS_FORMAT_NAME = "UP",
   $LS_FORMAT_TOP_NAME = "UP_TOP")[0]);

open UP, ">>$GS_Report" or die "append $GS_Report: $! ($^E)";

foreach my $ip (sort keys %GAA_Up) {    # You could sort on location
        ($GS_Location, $GS_IPAddr, $GS_UP, $GS_Time) = split /\t/, $GAA_Up{$ip};
        write UP;
}

close UP;

}

format UP_TOP =

==============================================================================
                              REACHABLE HOSTS REPORT

==============================================================================
  Location Name              IP Address        Status  Time
==============================================================================
.

format UP =
  @<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @>>>>>  @<<<<<<<<<<<<<<<<<<<<<<<
  $GS_Location,              $GS_IPAddr,       $GS_UP, $GS_Time
.

__END__

Result:

==============================================================================
                              REACHABLE HOSTS REPORT

==============================================================================
  Location Name              IP Address        Status  Time
==============================================================================
  ROOSEVELT FIELD            1.2.3.4               UP  Tue May  8 13:54:57 2007
  FASHION                    1.2.3.5               UP  Tue May  8 13:55:25 2007
  WESTMINSTER, CA            1.2.3.6               UP  Tue May  8 13:55:16 2007
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to