Stephen Reese wrote:
printf() (as seen three lines down) has a format string and a list of
values corresponding to the % escapes in that string. Because you are
using a string literal you should use print() instead.
foreach my $i (sort { $quad{$b} <=> $quad{$a} } keys %quad) {
if ($n++ >= $
> printf() (as seen three lines down) has a format string and a list of
> values corresponding to the % escapes in that string. Because you are
> using a string literal you should use print() instead.
>
> > foreach my $i (sort { $quad{$b} <=> $quad{$a} } keys %quad) {
> >if ($n++ >= $ntop) {
Stephen Reese wrote:
In your original post you presented *two* *separate* scripts and I
commented on both scripts, and now you are combining parts of both
scripts which is why you seem to be confused.
Hint: The "next unless //;" was a replacement for the "if (//) {}"
block.
John, originally I
Thank you!
On 9/23/08 3:10 PM, "John W. Krahn" <[EMAIL PROTECTED]> wrote:
Stephen Reese wrote:
> [snip]
>> #next unless /IPACCESSLOGP: list $acl denied ([tcpud]+)
>> ([0-9.]+)\([0-9]+\)\s*->\s*([0-9.]+)\(([0-9]+)\), ([0-9]+) \;
>>
> next unless /IPACCESSLOGP: list $acl denied ([tcpud]+) ([0-9.]+
> In your original post you presented *two* *separate* scripts and I
> commented on both scripts, and now you are combining parts of both
> scripts which is why you seem to be confused.
>
> Hint: The "next unless //;" was a replacement for the "if (//) {}"
> block.
John, originally I was trying t
Stephen Reese wrote:
[snip]
#next unless /IPACCESSLOGP: list $acl denied ([tcpud]+)
([0-9.]+)\([0-9]+\)\s*->\s*([0-9.]+)\(([0-9]+)\), ([0-9]+) \;
next unless /IPACCESSLOGP: list $acl denied ([tcpud]+) ([0-9.]+)\
([0-9]+\)\s*->\s*([0-9.]+)\(([0-9]+)\), ([0-9]+) /;
Thanks Ron that worked. What
[snip]
>
> #next unless /IPACCESSLOGP: list $acl denied ([tcpud]+)
> ([0-9.]+)\([0-9]+\)\s*->\s*([0-9.]+)\(([0-9]+)\), ([0-9]+) \;
>
next unless /IPACCESSLOGP: list $acl denied ([tcpud]+) ([0-9.]+)\
([0-9]+\)\s*->\s*([0-9.]+)\(([0-9]+)\), ([0-9]+) /;
Thanks Ron that worked. What is the 'next' stat
On Sep 22, 10:16 am, [EMAIL PROTECTED] (Stephen Reese) wrote:
> John,
>
> I made many of the changes but what is the addition of the 'next' statement
> for? I tried to add the additional code but the script dies mentioning that
> it is not terminated correctly. If I comment out the next statement t
John,
I made many of the changes but what is the addition of the 'next' statement
for? I tried to add the additional code but the script dies mentioning that
it is not terminated correctly. If I comment out the next statement the
script runs fine.
#!/usr/bin/perl
#
use warnings;
use strict;
# S
2008/9/22 Stephen Reese <[EMAIL PROTECTED]>:
>
> next unless /IPACCESSLOGP: list $acl denied ([tcpud]+)
> ([0-9.]+)\([0-9]+\)\s*->\s*([0-9.]+)\(([0-9]+)\), ([0-9]+) \
>
You didn't terminated this match statement.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMA
Okay I declared them with:
my ( %srca, %quad, %port, $foo, $moo );
The last error is "Search pattern not terminated at ./acl-parse.pl
line 28" or with the section of code below specifically the next
statement. I googled for the error and it seems like the '\' may need
to escape it but to escape I
Hi Stephen,
John is saying that you need to declare them, not initializing them.
Declaring them means that you're saying that variable will be used;
initializing them means giving them a value. With "use strict", you
need to define them before you give them a value...which is a good
sanity
2008/9/22 Stephen Reese <[EMAIL PROTECTED]>:
>> John is right.
>> You should always 'use strict' at the begin of the scripts.
>> Here you didn't declare the variables, so you got the errors.
>> You could declare them with:
>> my $x = ...;
>> my $foo = ...;
>>
>> For Perl's variable scope, see this:
> John is right.
> You should always 'use strict' at the begin of the scripts.
> Here you didn't declare the variables, so you got the errors.
> You could declare them with:
> my $x = ...;
> my $foo = ...;
>
> For Perl's variable scope, see this:
> http://perl.plover.com/FAQs/Namespaces.html
>
Jef
2008/9/22 Stephen Reese <[EMAIL PROTECTED]>:
>
> $ ./acl-parse.pl
> Global symbol "$x" requires explicit package name at ./acl-parse.pl
> line 22.
> Global symbol "$foo" requires explicit package name at ./acl-parse.pl
> line 23.
John is right.
You should always 'use strict' at the begin of the
John,
Thank you and everyone else for the insight to better Perl coding
practices in the original script. I have attempted to make the changes
that you recommended with negative results. I had a tough time trying
to determine what to leave in so before I move on to the new script I
would like to f
"John W. Krahn" schreef:
> Stephen Reese:
>> chomp ($acl=$ARGV[0]);
>> if ($acl eq "") { $acl=".*"};
>
> my $acl = $ARGV[ 0 ] || '.*';
The chomp() can make a difference:
$ perl -wle 'my $x = $ARGV[0] || q{.*}; print qq{<$x>}' ''
<.*>
$ perl -wle 'my $x = $ARGV[0] || q{.*}; print qq{<$x>}' '
'
Stephen Reese wrote:
I found a Perl script that parses Cisco ACL logging format and I would
like to modify it to parse the IPS format that Cisco uses. I have made
changes to the expression that picks up the Rule and the script still
runs but there isn't any useful output. Any recommendations woul
I found a Perl script that parses Cisco ACL logging format and I would
like to modify it to parse the IPS format that Cisco uses. I have made
changes to the expression that picks up the Rule and the script still
runs but there isn't any useful output. Any recommendations would be
great.
Here's wha
19 matches
Mail list logo