develooper Front page | perl.beginners | Postings from January 2002

Problem with format command

Thread Next
From:
Michael Eggleton
Date:
January 31, 2002 17:36
Subject:
Problem with format command
Message ID:
MDAEMON-F200201312033.AA330701md50000052175@gorealnetworks.com
Hello All,

Here is the code for the format command:
use Win32::Service;
push( @ARGV, Win32::NodeName() ) unless( scalar @ARGV );
foreach my $Machine ( @ARGV )
{
    local %List;
    print "Available services on $Machine:\n";
    if( Win32::Service::GetServices( $Machine, \%List ) )
    {
        $~ = FormatHeader;
        write;
        $~ = FormatData;
        foreach $Service ( sort( keys( %List ) ) )
        {
            write;
        }
        print "\n" x 3;
    }
    else
    {
        print Win32::FormatMessage( Win32::GetLastError() ), "\n";
    }
}

 format FormatHeader =
 @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 "Service Name",    "Service Display Name"
 ---------------------------------------------------------- ------------
----------------------------------------------
 .

 format FormatData =
 @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 $List{$Service},   $Service
 .

And here is the error.

Missing right curly or square bracket at example_8_1.pl line 38, at end 
of linesyntax error at example_8_1.pl line 38, at EOF
Execution of example_8_1.pl aborted due to compilation errors.

And if I replace < with | or > it works just fine.

Michael D. Eggleton
http://www.gorealnetworks.com
mailto:meggleton@gorealnetworks.com



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About