Chas. Owens wrote:
On Mon, Apr 14, 2008 at 12:50 AM, Richard Lee <[EMAIL PROTECTED]> wrote:
snip
my $start = qr/@{[ POSIX::strftime( '%b %e %H:', localtime time - ONE_HOUR )
]}/;
snip
I will have to try out your POSIX solution as I have particular in adding
space if date is s
Richard Lee wrote:
John W. Krahn wrote:
Or you could do something like this:
use POSIX ();
use constant ONE_HOUR => 60 * 60;
my $file_name = '/var/log/server.log';
my @bad = do {
my $start = qr/@{[ POSIX::strftime( '%b %e %H:', localtime time -
ONE_HOUR ) ]}/;
open my $SOURCE, '<
On Mon, Apr 14, 2008 at 12:50 AM, Richard Lee <[EMAIL PROTECTED]> wrote:
snip
> >my $start = qr/@{[ POSIX::strftime( '%b %e %H:', localtime time -
> > ONE_HOUR ) ]}/;
snip
> I will have to try out your POSIX solution as I have particular in adding
> space if date is single digits (April 3 get
John W. Krahn wrote:
Richard Lee wrote:
John W. Krahn wrote:
Richard Lee wrote:
John W. Krahn wrote:
Richard Lee wrote:
John W. Krahn wrote:
You are not returning the contents of @bad and you are not
passing in the name of the file to open so I assume that this is
in a subroutine becaus
On Sun, Apr 13, 2008 at 11:13 PM, John W. Krahn <[EMAIL PROTECTED]> wrote:
> Chas. Owens wrote:
>
> > On Sun, Apr 13, 2008 at 10:44 PM, John W. Krahn <[EMAIL PROTECTED]> wrote:
> > snip
> > > > does subroutine introduce additional delay?
> > > All non-inlined subroutines introduce some delay, alth
Chas. Owens wrote:
On Sun, Apr 13, 2008 at 10:44 PM, John W. Krahn <[EMAIL PROTECTED]> wrote:
snip
does subroutine introduce additional delay?
All non-inlined subroutines introduce some delay, although that is not your
problem as you are only calling it once.
snip
Perl has inlined subroutin
On Sun, Apr 13, 2008 at 10:44 PM, John W. Krahn <[EMAIL PROTECTED]> wrote:
snip
> > does subroutine introduce additional delay?
> >
>
> All non-inlined subroutines introduce some delay, although that is not your
> problem as you are only calling it once.
snip
Perl has inlined subroutines now? Wh
On Sun, Apr 13, 2008 at 9:21 PM, Richard Lee <[EMAIL PROTECTED]> wrote:
snip
> does subroutine introduce additional delay?
snip
Yes, there is a non-trivial amount of work done setting up a function
call; however, since you are only calling it once that isn't a big
deal. My rule of thumb for crea
Richard Lee wrote:
John W. Krahn wrote:
Richard Lee wrote:
John W. Krahn wrote:
Richard Lee wrote:
John W. Krahn wrote:
You are not returning the contents of @bad and you are not passing
in the name of the file to open so I assume that this is in a
subroutine because you are calling it m
John W. Krahn wrote:
Richard Lee wrote:
John W. Krahn wrote:
Richard Lee wrote:
John W. Krahn wrote:
You are not returning the contents of @bad and you are not passing
in the name of the file to open so I assume that this is in a
subroutine because you are calling it many times in your pro
Richard Lee wrote:
John W. Krahn wrote:
Richard Lee wrote:
John W. Krahn wrote:
You are not returning the contents of @bad and you are not passing
in the name of the file to open so I assume that this is in a
subroutine because you are calling it many times in your program?
Yes, it is sub
John W. Krahn wrote:
Richard Lee wrote:
John W. Krahn wrote:
Richard Lee wrote:
sub shove_it {
my $start = time_this(scalar localtime( ( time() - ( 60 * 60
) ) ));
What does the time_this() function do?
sub time_this {
my $chunli = join(' ', ( split( /\s+/, $_[0]))[1,2,3]);
Richard Lee wrote:
John W. Krahn wrote:
Richard Lee wrote:
sub shove_it {
my $start = time_this(scalar localtime( ( time() - ( 60 * 60 )
) ));
What does the time_this() function do?
sub time_this {
my $chunli = join(' ', ( split( /\s+/, $_[0]))[1,2,3]);
if ($chunli =~ s
On Sun, Apr 13, 2008 at 4:12 PM, John W. Krahn <[EMAIL PROTECTED]> wrote:
snip
> > > push @bad, "$3_$5_$4_$6_$2_$1";
> > >
> > snip
> >
> > I believe they would come out roughly the same in terms of
> > performance, but, in general, I don't trust $1, $2, etc outside of a
> > substitution. I have
Chas. Owens wrote:
On Sun, Apr 13, 2008 at 3:20 PM, John W. Krahn <[EMAIL PROTECTED]> wrote:
snip
Why not just:
snip
push @bad, "$3_$5_$4_$6_$2_$1";
snip
I believe they would come out roughly the same in terms of
performance, but, in general, I don't trust $1, $2, etc outside of a
substitu
John W. Krahn wrote:
Richard Lee wrote:
sub shove_it {
my $start = time_this(scalar localtime( ( time() - ( 60 * 60 )
) ));
What does the time_this() function do?
sub time_this {
my $chunli = join(' ', ( split( /\s+/, $_[0]))[1,2,3]);
if ($chunli =~ s/^(\S\S\S)(\s)(\d\d\
On Sun, Apr 13, 2008 at 3:20 PM, John W. Krahn <[EMAIL PROTECTED]> wrote:
snip
> Why not just:
snip
> push @bad, "$3_$5_$4_$6_$2_$1";
snip
I believe they would come out roughly the same in terms of
performance, but, in general, I don't trust $1, $2, etc outside of a
substitution. I have been bi
Chas. Owens wrote:
On Sun, Apr 13, 2008 at 2:32 PM, Richard Lee <[EMAIL PROTECTED]> wrote:
snip
But I am not 100% sure what you are saying on " Why are you making sure the
data is right and then pulling the data you want out? " ?
I need to move onto next data if it doesn't conform to 2nd regex
Chas. Owens wrote:
On Sun, Apr 13, 2008 at 2:32 PM, John W. Krahn <[EMAIL PROTECTED]> wrote:
snip
Or better, use the qr// operator to compile $start.
perldoc -q /o
snip
I thought about suggesting qr//, but the source of $start is
my $start = time_this(scalar localtime( ( time() - ( 60 * 6
Richard Lee wrote:
sub shove_it {
my $start = time_this(scalar localtime( ( time() - ( 60 * 60 ) ) ));
What does the time_this() function do?
open my $source, "<", "/var/log/server.log"
or die "Could NOT open /var/log/server.log: $!";
while ( <$source> )
On Sun, Apr 13, 2008 at 2:32 PM, Richard Lee <[EMAIL PROTECTED]> wrote:
snip
> But I am not 100% sure what you are saying on " Why are you making sure the
> data is right and then pulling the data you want out? " ?
> I need to move onto next data if it doesn't conform to 2nd regex and then I
> am
Chas. Owens wrote:
On Sun, Apr 13, 2008 at 2:05 PM, Richard Lee <[EMAIL PROTECTED]> wrote:
snip
next if ! /^$start/;
snip
You should say
next unless /^$start/o;
The o makes a promise that $start won't change, so the regex only gets
compiled once (it is recompiling the rege
Chas. Owens wrote:
On Sun, Apr 13, 2008 at 2:05 PM, Richard Lee <[EMAIL PROTECTED]> wrote:
snip
next if ! /^$start/;
snip
You should say
next unless /^$start/o;
The o makes a promise that $start won't change, so the regex only gets
compiled once (it is recompiling the regex each t
Richard Lee wrote:
why does below fail?
- where it's failing -
open my $source, "<", "/tmp/server.log"
or die "Could NOT open /var/log/server.log: $!";
$source is an opened filehandle.
my $file = new IO::Handle;
$file is an IO::Handle object but it is not rela
On Sun, Apr 13, 2008 at 2:16 PM, Chas. Owens <[EMAIL PROTECTED]> wrote:
snip
> >next if ! m{
> >.+\s+D\s+
> > udp\s+
> > \d+\.\d+\.\d+\.\d+\s+
> > \d+\.\d+\.\d+\.\d+\s+
> >
On Sun, Apr 13, 2008 at 2:05 PM, Richard Lee <[EMAIL PROTECTED]> wrote:
snip
>next if ! /^$start/;
snip
You should say
next unless /^$start/o;
The o makes a promise that $start won't change, so the regex only gets
compiled once (it is recompiling the regex each time through the loop
Rob Dixon wrote:
Richard Lee wrote:
why does below fail?
- where it's failing -
open my $source, "<", "/tmp/server.log"
or die "Could NOT open /var/log/server.log: $!";
my $file = new IO::Handle;
while ($_ = $file->getline($source) ) {
--
On Sun, Apr 13, 2008 at 1:35 PM, Richard Lee <[EMAIL PROTECTED]> wrote:
> why does below fail?
>
> - where it's failing -
> open my $source, "<", "/tmp/server.log"
> or die "Could NOT open /var/log/server.log: $!";
> my $file = new IO::Handle;
> while ($_ = $fil
Richard Lee wrote:
>
> why does below fail?
>
> - where it's failing -
> open my $source, "<", "/tmp/server.log"
> or die "Could NOT open /var/log/server.log: $!";
> my $file = new IO::Handle;
> while ($_ = $file->getline($source) ) {
> ---
why does below fail?
- where it's failing -
open my $source, "<", "/tmp/server.log"
or die "Could NOT open /var/log/server.log: $!";
my $file = new IO::Handle;
while ($_ = $file->getline($source) ) {
Uncaught exception from user cod
30 matches
Mail list logo