Re: Regex for logwatch report

2004-10-05 Thread Kevin Old
On Tue, 05 Oct 2004 22:46:58 -0400, Randy W. Sims <[EMAIL PROTECTED]> wrote: > On 10/5/2004 10:36 PM, Randy W. Sims wrote: > > > while (defined( my $line = )) { > > if ( /-+ pam_unix Begin -+/ .. /-+ pam_unix End -+/ ) { > > # between beginning and end > > } > > } > > err, that w

Re: Regex for logwatch report

2004-10-05 Thread Randy W. Sims
On 10/5/2004 10:36 PM, Randy W. Sims wrote: while (defined( my $line = )) { if ( /-+ pam_unix Begin -+/ .. /-+ pam_unix End -+/ ) { # between beginning and end } } err, that was obviously not tested. Should be: while (defined( my $line = )) { if ( $line =~ /begin/ .. $line =~

Re: Regex for logwatch report

2004-10-05 Thread Kevin Old
On Tue, 05 Oct 2004 22:36:45 -0400, Randy W. Sims <[EMAIL PROTECTED]> wrote: > On 10/5/2004 10:25 PM, Kevin Old wrote: > > Hello everyone, > > > > I'm parsing a Logwatch report I get daily from my server and have hit > > a snag. I'd like to grab everything between the "pam_unix Begin" line > > and

Re: Regex for logwatch report

2004-10-05 Thread Randy W. Sims
On 10/5/2004 10:25 PM, Kevin Old wrote: Hello everyone, I'm parsing a Logwatch report I get daily from my server and have hit a snag. I'd like to grab everything between the "pam_unix Begin" line and the "pam_unix End" line. - pam_unix Begin sshd:

Regex for logwatch report

2004-10-05 Thread Kevin Old
Hello everyone, I'm parsing a Logwatch report I get daily from my server and have hit a snag. I'd like to grab everything between the "pam_unix Begin" line and the "pam_unix End" line. - pam_unix Begin sshd: Invalid Users: Unknown Account:

Re: newbie stuck in a HOA

2004-10-05 Thread Bee
Try this and hope this would help more *Code not tested* Suppose data in cancel.txt : 123456|X 234567|X Suppose data in falldata.tmp : 028076|Blood|Sept 18|Sat|San Francisco|028086.html|1|275|0|| 123456|Quake|Sept 19|Sun|Home|028087.html|1|275|0|| 234567|Doom|Sept 20|Mon|Page Up|028088.html|1

Re: newbie stuck in a HOA

2004-10-05 Thread Bee
- Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 06, 2004 4:32 AM Subject: newbie stuck in a HOA > Hi all, > > I have a flatfile database (falldata.tmp) that contains information about > all the courses offered > this includes: course numbe

Re: OT: Email syntax validation

2004-10-05 Thread Gunnar Hjalmarsson
JupiterHost.Net wrote: I beleive you're taking everyone's good advice as a personal attack. Now you are using that word "attack" again, and I can asure you that I'm not. Everyone is trying to help you. Do whatever you want, but if you don't want answers don't ask for free help :) Well, my initial p

Re: Passing shell variables to PERL

2004-10-05 Thread John W. Krahn
Jim wrote: Willy Perez wrote: Is there a method to pass a shell assigned variable to perl? For ex: ABC=xyc perl -ne 'print $ABC' In awk you could use ENVIRON["varname"], is there something compatible in perl. You can do the same in perl with the special hash named %ENV. for instance: print $ENV{'

Re: RFC on script // GetOptions problems

2004-10-05 Thread RichT
Fist of all thank you both very much, this has been a good learning experience. [snip] > From: RichT wrote: > > : im still very new to perl > > : what is does in searches through a large data file finds the > : segments i need and outputs the data in a more

newbie stuck in a HOA

2004-10-05 Thread pmd
Hi all, I have a flatfile database (falldata.tmp) that contains information about all the courses offered this includes: course number, course title, start date, day of week, location, html link, section number, fee1, fee2, and status. I have another file (cancel.txt) which contains a list of the

Re: Reg Exp

2004-10-05 Thread John W. Krahn
[Please do not top-post. TIA] David le Blanc wrote: On Tue, 05 Oct 2004 04:03:21 -0700, John W. Krahn <[EMAIL PROTECTED]> wrote: Mallik wrote: I have the below code. my $a = ":-:m:-:a:-:l:-:i:-:k"; # Here each letter is separated by :-: my $del = ':-:'; # Delimeter my $b; while ($a ne $b) { $a

Re: Mod Perl Helper Functions

2004-10-05 Thread James Taylor
Bob Showalter wrote: FWIW, That example works OK for me under Apache 1.3.31, mod_perl 1.29 when I run under Apache::Registry. I had to add a declaration for %somehash, but otherwise it runs without error. Is main.pl running under Apache::Registry, or is it a PerlHandler or some other type of handle

Re: OT: Email syntax validation

2004-10-05 Thread JupiterHost.Net
I beleive you're taking everyone's good advice as a personal attack. Everyone is trying to help you avoid pitfall's you're likley to come accross based on experience, lots of it. Everyone is trying to help you. Do whatever you want, but if you don't want answers don't ask for free help :) Sill

Re: OT: Email syntax validation

2004-10-05 Thread Gunnar Hjalmarsson
Randal L. Schwartz wrote: Gunnar Hjalmarsson writes: I hear that you have never distributed CGI scripts to people who typically have never heard of CPAN and don't have shell access, and to whom Perl and CGI are synonyms. That's the 'business' I am in. Then cut and paste the relevant parts of Email:

RE: Mod Perl Helper Functions

2004-10-05 Thread Bob Showalter
James Taylor wrote: > I posted this to the mod_perl list 2 days ago, but it seems a bit > inappropriate there as the discussion is much more > advanced than my question... That and I haven't gotten a response, so > sorry for the crosspost :) > > I'm running apache 1.3.x with the associated version

Re: sum a column

2004-10-05 Thread JupiterHost.Net
Compare perl -mstrict -we 'my $v;for(1..3) { print "$v\n";$v++; }' with perl -mstrict -we 'my $v = "";for(1..3) { print "$v\n";$v++; }' Hmm, I could swear I read in my manual that perl will automatically initialize variables. But, that's obviously not case, as your example demonstrates. Thanks

Re: Passing shell variables to PERL

2004-10-05 Thread Willy Perez
Thanks Errin/Jim/David, Hi Willy, Perl will auto-magically take all of your shell environment variables and put them in a hash: %ENV where the keys are the variable names and the values are the values! so, for your example above, # perl -e 'print "$ENV{ABC}\n"' should work! --Errin You ca

Re: DBI hashref with multiple db rows

2004-10-05 Thread Wiggins d Anconia
> >> > I have created a module, and inside one of the Package methods, I > >> have > >> > the following code: > >> > > >> > $href = $getPlanInfo->fetchrow_hashref(); > >> > foreach my $key (keys %$href) { > >> > print "$key : $href->{$key}\n"; > >> > $name =

Mod Perl Helper Functions

2004-10-05 Thread James Taylor
I posted this to the mod_perl list 2 days ago, but it seems a bit inappropriate there as the discussion is much more advanced than my question... That and I haven't gotten a response, so sorry for the crosspost :) I'm running apache 1.3.x with the associated version of mod_perl, but am having t

Re: Passing shell variables to PERL

2004-10-05 Thread Errin Larsen
On Tue, 5 Oct 2004 14:32:27 -0400, Willy Perez <[EMAIL PROTECTED]> wrote: > > Hi, > > Is there a method to pass a shell assigned variable to perl? > > For ex: > > ABC=xyc > > perl -ne 'print $ABC' > > In awk you could use ENVIRON["varname"], is there something > compatible in perl. > > > Wi

RE: Passing shell variables to PERL

2004-10-05 Thread Jim
> Hi, > > Is there a method to pass a shell assigned variable to perl? > > For ex: > > ABC=xyc > > perl -ne 'print $ABC' > > In awk you could use ENVIRON["varname"], is there something > compatible in perl. > You can do the same in perl with the special hash named %ENV. for instance: pr

Re: Passing shell variables to PERL

2004-10-05 Thread David Greenberg
$ENV{"ABC"} This works for me, but I don't have a good understanding of what is going on to make it work. HTH, David On Tue, 5 Oct 2004 14:32:27 -0400, Willy Perez <[EMAIL PROTECTED]> wrote: > > Hi, > > Is there a method to pass a shell assigned variable to perl? > > For ex: > > ABC=xyc > >

Passing shell variables to PERL

2004-10-05 Thread Willy Perez
Hi, Is there a method to pass a shell assigned variable to perl? For ex: ABC=xyc perl -ne 'print $ABC' In awk you could use ENVIRON["varname"], is there something compatible in perl. Willy Perez Liz Claiborne IT (201) 295-7011

Re: sum a column

2004-10-05 Thread Denzil Kruse
--- "JupiterHost.Net" <[EMAIL PROTECTED]> wrote: > > Isn't $prev_date assigned to '', and isn't that > > It is if you do > my $prev_date = ''; > but > my $prev_date; > it is "uninitialized" as in it hasn't been assigned > any value incuding > "empty" > > Compare > perl -mstrict -we 'my $

Re: DBI hashref with multiple db rows

2004-10-05 Thread Steve Bertrand
>> > I have created a module, and inside one of the Package methods, I >> have >> > the following code: >> > >> > $href = $getPlanInfo->fetchrow_hashref(); >> > foreach my $key (keys %$href) { >> > print "$key : $href->{$key}\n"; >> > $name = $key; >> >

Re: DBI hashref with multiple db rows

2004-10-05 Thread Wiggins d Anconia
Please bottom post > Steve > > You may want to think of this from a DB perspective. > > Is there a unique key associated with each of these lookups that could prevent duplicate rows being returned? If you are looking up info for a particular person, I would assume you would only want 1 retu

Re: DBI hashref with multiple db rows

2004-10-05 Thread Steve Bertrand
> Steve > > You may want to think of this from a DB perspective. > > Is there a unique key associated with each of these lookups that could > prevent duplicate rows being returned? If you are looking up info for > a particular person, I would assume you would only want 1 returned and > you would wa

Re: DBI hashref with multiple db rows

2004-10-05 Thread jason_normandin
Steve You may want to think of this from a DB perspective. Is there a unique key associated with each of these lookups that could prevent duplicate rows being returned? If you are looking up info for a particular person, I would assume you would only want 1 returned and you would want a key wi

DBI hashref with multiple db rows

2004-10-05 Thread Steve Bertrand
I have created a module, and inside one of the Package methods, I have the following code: $href = $getPlanInfo->fetchrow_hashref(); foreach my $key (keys %$href) { print "$key : $href->{$key}\n"; $name = $key; $self->{$name} = $href->{$key};

Re: sum a column

2004-10-05 Thread JupiterHost.Net
my $prev_date; if ( $prev_date ne 'foo' ) {## LINE 28 ## print 'foo'; } Since prev_date does not have value, it cannot be compared without raising a warning. On the second pass $prev_date has a value. Isn't $prev_date assigned to '', and isn't that It is if you do my $prev_date = ''; bu

RE: sum a column

2004-10-05 Thread Denzil Kruse
--- "Charles K. Clarkson" <[EMAIL PROTECTED]> wrote: [snip] > > my $prev_date; > if ( $prev_date ne 'foo' ) {## LINE 28 ## > print 'foo'; > } > > Since prev_date does not have value, it cannot > be compared > without raising a warning. On the second pass > $prev_date has > a value.

RE: Reg Exp

2004-10-05 Thread Chris Devers
On Tue, 5 Oct 2004, Mallik wrote: But I am a new-bie to Perl. Can u give me a example for 'look-ahead' matches. 30 seconds on Google returned *lots* of documentation. Here's some of it:

Re: Email syntax validation

2004-10-05 Thread JupiterHost.Net
Randal L. Schwartz wrote: "NYIMI" == NYIMI Jose (BMB) <[EMAIL PROTECTED]> writes: Silly person. NYIMI> Oh oh! What's this ? NYIMI> I can't imagine that's comes from Randal :-( Why not? It's saying what I feel about that. I'm using "silly" rather casually here. Maybe that's not coming through

Re: Email syntax validation

2004-10-05 Thread Randal L. Schwartz
> "NYIMI" == NYIMI Jose (BMB) <[EMAIL PROTECTED]> writes: >> Silly person. NYIMI> Oh oh! What's this ? NYIMI> I can't imagine that's comes from Randal :-( Why not? It's saying what I feel about that. I'm using "silly" rather casually here. Maybe that's not coming through very well in ema

RE: speed of grep{s///} vs ??? or am i asking the wrong question?

2004-10-05 Thread Bakken, Luke
> >opendir LS, $directory or die "Can't opendir $directory: $!"; > >my @dirs = grep { -d $_ } readdir LS; > >closedir LS; > >return @dirs; > > thank you this is much more readable code too me- but i found out that > you need a fully qualified path... Right, either that or chdir first before doing

RE: Email syntax validation

2004-10-05 Thread NYIMI Jose \(BMB\)
> -Original Message- > From: Randal L. Schwartz [mailto:[EMAIL PROTECTED] > Sent: Tuesday, October 05, 2004 4:31 PM > To: [EMAIL PROTECTED] > Subject: Re: Email syntax validation > > > Silly person. Oh oh! What's this ? I can't imagine that's comes from Randal :-( José. DISC

Re: OT: Email syntax validation

2004-10-05 Thread Randal L. Schwartz
> "Gunnar" == Gunnar Hjalmarsson <[EMAIL PROTECTED]> writes: Gunnar> Yeah, I noticed that, too. Randal should really think twice before Gunnar> including '&' in his real addresses. :) This is why I have to fight the continual battle. Too many websites are borked. -- Randal L. Schwartz - St

Re: OT: Email syntax validation

2004-10-05 Thread Randal L. Schwartz
> "Gunnar" == Gunnar Hjalmarsson <[EMAIL PROTECTED]> writes: Gunnar> I hear that you have never distributed CGI scripts to people who Gunnar> typically have never heard of CPAN and don't have shell access, and to Gunnar> whom Perl and CGI are synonyms. That's the 'business' I am in. Then cut

RE: speed of grep{s///} vs ??? or am i asking the wrong question?

2004-10-05 Thread West, William M
>-Original Message- >From: Bakken, Luke [mailto:[EMAIL PROTECTED] >Sent: Monday, October 04, 2004 5:06 PM >To: West, William M; [EMAIL PROTECTED] >Subject: RE: speed of grep{s///} vs ??? or am i asking the wrong question? > >Try this, you don't need to shell out. It returns an array of >

RE: Reg Exp

2004-10-05 Thread Mallik
Hi David, Thanks for ur suggestion. But I am a new-bie to Perl. Can u give me a example for 'look-ahead' matches. Regards, Mallik. -Original Message- From: David le Blanc [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 05, 2004 5:57 PM To: John W. Krahn Cc: Perl Beginners Subject: Re:

Re: Serial Port Access

2004-10-05 Thread Tim Donahue
On Mon, 2004-10-04 at 17:16, Chris Devers wrote: > On Mon, 4 Oct 2004, Tim Donahue wrote: > > > I'm looking for a module that will allow me to send/receive ascii data > > to a serial port. I have a program that will allow me to query its > > status over a serial connection, but I can't find a mod

Re: smtp support attach?

2004-10-05 Thread JupiterHost.Net
Adam Saeed wrote: could any one tell me that SMTP::Net support attachment, if yes how it could be to do so... Net::SMTP technically does but you'd have todo a lot of work. (IE like how you'd do anattachemnt by SMTP vie CLI) Try Jenda's excellent Mail::Sender module, it handles attachments very

Re: Reg Exp

2004-10-05 Thread David le Blanc
Your use of (.?)($del)? does not do what you expect. In the case of :-:a:-: you will find (.?) = 'a' and ($del)? matches a delimiter, BUT :-::-:you will find (.?) = ":" and ($del)? matches nothing. Check out 'look-ahead' matches for a way to solve this. On Tue, 05 Oct 2004 04:03:21 -070

Re: deleting a mirror from CPAN.pm, was Re: CPAN

2004-10-05 Thread Peter Scott
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Chris Devers) writes: >Please use a more descriptive subject line. > >On Mon, 4 Oct 2004, Bob Gordon wrote: > >> Anyone know how to remove a mirror from the list that CPAN uses? I >> would like to remove ftp://carroll.cac.psu.edu from the list a

Re: How may anonymous tables?

2004-10-05 Thread Ricardo SIGNES
* adam <[EMAIL PROTECTED]> [2004-10-04T22:32:50] > Here is the code: > my $r1 = [1,2]; > my $r2 = [1,2]; > > How many anonymous arrays do we have now? > One or two? > This shows we have two arrays: print "$r1\n$r2\n"; Two. > Is there any way to find out how the system is naming these arrays >

Re: smtp support attach?

2004-10-05 Thread Jenda Krynicky
From: Adam Saeed <[EMAIL PROTECTED]> > could any one tell me that SMTP::Net support attachment, if yes how it > could be to do so... thanks I believe you meant Net:SMTP. No it doesn't. Net::SMTP does just the low level SMTP stuff, no MIME, no multipart messages, no attachments.

Re: References to anon array

2004-10-05 Thread John W. Krahn
Adam wrote: I am expecting in both examples the same result: Example1: the same references Example2: the same references However, I get: Example1: different references Example2: the same references What am I missing? #Example1 my $r1 = [1, 3]; Store a reference to an anonymous array in a scalar. my

Re: Reg Exp

2004-10-05 Thread John W. Krahn
Mallik wrote: Dear Friends, Hello, I have the below code. my $a = ":-:m:-:a:-:l:-:i:-:k"; # Here each letter is separated by :-: my $del = ':-:'; # Delimeter my $b; while ($a ne $b) { $a =~ /^$b$del(.?)($del)?/; my $c = $1; print "$c\n"; $b .= $del . $c; } The above code is working

Re: perl regex to array

2004-10-05 Thread Gavin Henry
Ramprasad A Padmanabhan said: > Hi, > > I have slightly a tricky situation, in my large program. I am trying the > best to reproduce it > > > I have a string like this > $x='a{1}b{21}c{5}d'; > # The numbers in the {} are random and are not of interest > > I want to access all elements from the st

References to anon array

2004-10-05 Thread Adam
I am expecting in both examples the same result: Example1: the same references Example2: the same references However, I get: Example1: different references Example2: the same references What am I missing? thanks adam Here is the code: #Example1 my $r1 = [1, 3]; my $r2 = [1, 3]; if ($r1 eq $r2)

Re: OT: Email syntax validation

2004-10-05 Thread Jose Alves de Castro
On Mon, 2004-10-04 at 17:57, JupiterHost.Net wrote: > > > > When people undiscriminatingly advocate the use of modules whenever > > possible, I get unhappy. I'm using modules when I consider it to be > > suitable. > > > > Peace my friend, do whatever you want. > It wasn't an attack, that's what

How may anonymous tables?

2004-10-05 Thread adam
Here is the code: my $r1 = [1,2]; my $r2 = [1,2]; How many anonymous arrays do we have now? One or two? This shows we have two arrays: print "$r1\n$r2\n"; Is there any way to find out how the system is naming these arrays internally? thanks adam -- To unsubscribe, e-mail: [EMAIL PROTECTED

Re: Can you help me design a perl class/classes ?

2004-10-05 Thread Gabor Urban
On Mon, 2004-10-04 at 21:00, Graeme McLaren wrote: > Hey all .. I'm thinkin about writing a web application using perl > and object oriented techniques. > Nice try, a good point learning OOP in any language. Design issues are not so easy to counsel. > I want to start off small ... le

RE: sum a column

2004-10-05 Thread Charles K. Clarkson
rmck <[EMAIL PROTECTED]> wrote: Please stop top posting. : I had to add a "print $sum !=" to inside and outside the : while loop. Im not sure why it is working this way?? Also : Im getting an error "Use of uninitialized value in string : ne at ./clean1.pl line 28, line 1." ?? Break it d

Reg Exp

2004-10-05 Thread Mallik
Dear Friends, I have the below code. my $a = ":-:m:-:a:-:l:-:i:-:k"; # Here each letter is separated by :-: my $del = ':-:'; # Delimeter my $b; while ($a ne $b) { $a =~ /^$b$del(.?)($del)?/; my $c = $1; print "$c\n"; $b .= $del . $c; } The above code is working fine. But when I