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

RE: Problem with format command

Thread Previous
From:
Michael Eggleton
Date:
February 1, 2002 13:03
Subject:
RE: Problem with format command
Message ID:
00cc01c1ab63$ba125480$1464a8c0@EGGSDELL
Ok, Did I ask a dumb question? or is there just no answer?

-----Original Message-----
From: Michael Eggleton [mailto:meggleton@gorealnetworks.com]
Sent: Thursday, January 31, 2002 8:33 PM
To: beginners@perl.org
Subject: Problem with format command


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



-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org



Thread Previous


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