Having a syntax problem and don't see it, do you?
Here's the output from the command line:
C:\Perl\site\bin>perl -w ports.pl
syntax error at ports.pl line 21, near ")
{"
syntax error at ports.pl line 25, near "}"
Execution of ports.pl aborted due to compilation errors.
#!/usr/bin/perl -w
#************************************************
# modify list of ports for use in cisco/catos command file
#************************************************
# < or r Read Only Access
# > or w Creates, Writes, and Truncates
# >> or a Writes, Appends, and Creates
# +< or r+ Reads and Writes
# +> or w+ Reads, Writes, Creates, and Truncates
# +>> or a+ Reads, Writes, Appends, and Creates
open (COMMANDS, "<commands.txt") or die "Could not open commands.txt.\n";
@commands = <COMMANDS>;
close COMMANDS;
#
$x = 0;
#
While ( $commands[$x] )
{
chomp ($commands[$x]);
print "$command[$x]\n";
$x= $x + 1;
};
Here's the output from the command line:
C:\Perl\site\bin>perl -w ports.pl
syntax error at ports.pl line 21, near ")
{"
syntax error at ports.pl line 25, near "}"
Execution of ports.pl aborted due to compilation errors.
#!/usr/bin/perl -w
#************************************************
# modify list of ports for use in cisco/catos command file
#************************************************
# < or r Read Only Access
# > or w Creates, Writes, and Truncates
# >> or a Writes, Appends, and Creates
# +< or r+ Reads and Writes
# +> or w+ Reads, Writes, Creates, and Truncates
# +>> or a+ Reads, Writes, Appends, and Creates
open (COMMANDS, "<commands.txt") or die "Could not open commands.txt.\n";
@commands = <COMMANDS>;
close COMMANDS;
#
$x = 0;
#
While ( $commands[$x] )
{
chomp ($commands[$x]);
print "$command[$x]\n";
$x= $x + 1;
};