Re: putting ";" as a replacement in the substitution.

2007-01-21 Thread Ovid
--- Michael Alipio <[EMAIL PROTECTED]> wrote: > It would be pointless to put () in my regexp when testing with if, unless > I'm grouping something or I want to do something with $1. Correct. > if /(^\w+)\s+/ > > But if I am assigning something, like: > > my $captured =~ /^(\w+)\s+/ > > I s

Re: Pattern Matching

2007-01-21 Thread Dharshana Eswaran
On 1/19/07, John W. Krahn <[EMAIL PROTECTED]> wrote: Dharshana Eswaran wrote: > Hi All, Hello, > I have a string as shown below: > > $string = > "{[0]=0x53,[1]=0x65,[2]=0x63,[3]=0x75,[4]=0x72,[5]=0x69,[6]=0x74,[7]=0x79,[8]=0x43,[9]=0x6F,[10]=0x64,[11]=0x65,[12]=0x00}" > > > This is stored as a

Re: Pattern Matching

2007-01-21 Thread Dharshana Eswaran
On 1/19/07, Rob Dixon <[EMAIL PROTECTED]> wrote: Igor Sutton wrote: > I have an update: > >> my @data = $string =~ m/0x(\d{2})/g; > > my @data = $string =~ m/0x(\S{2}),?/g; > > Now I think it is right :) my @data = $string =~ m/=0x(..)/g; :) Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] F

Re: Pattern Matching

2007-01-21 Thread Dharshana Eswaran
On 1/19/07, Igor Sutton <[EMAIL PROTECTED]> wrote: I have an update: > my @data = $string =~ m/0x(\d{2})/g; my @data = $string =~ m/0x(\S{2}),?/g; Now I think it is right :) -- Igor Sutton Lopes <[EMAIL PROTECTED]> I used the above expression and it worked for me. Thanks you so much. Tha

Trouble appending into gzipped file using Compress::Zlib (Re: compressing files into tar.gz (which module do you prefer)

2007-01-21 Thread Michael Alipio
Hi, - Original Message From: Rob Dixon <[EMAIL PROTECTED]> To: Michael Alipio <[EMAIL PROTECTED]> Cc: beginners@perl.org Sent: Monday, January 22, 2007 10:46:40 AM Subject: Re: compressing files into tar.gz (which module do you prefer) Michael Alipio wrote: > Hi, > > After parsing a log

Re: compressing files into tar.gz (which module do you prefer)

2007-01-21 Thread Rob Dixon
Michael Alipio wrote: Hi, After parsing a log and writing it into a file, I now, have to compress it into tar.gz. Right now, I'm doing a search at CPAN and there where too many modules out there with "compress" or "archive" search keyword. What do you suggest? Archive::Tar Rob -- To unsubsc

Re: Global variable - No of hits counter

2007-01-21 Thread Mumia W.
On 01/21/2007 04:55 PM, tom tom wrote: Hi, In my mod_perl (Authentication module). I have global variable defined as follows use vars qw( $SESSION_CLEANUP_COUNTER); $SESSION_CLEANUP_COUNTER=0; my intention is to count no of times it is getting executed by clients (no of hits). I am incrementi

compressing files into tar.gz (which module do you prefer)

2007-01-21 Thread Michael Alipio
Hi, After parsing a log and writing it into a file, I now, have to compress it into tar.gz. Right now, I'm doing a search at CPAN and there where too many modules out there with "compress" or "archive" search keyword. What do you suggest? Thanks __

Re: character classes vs regexp alternatives (using "( )" or "[ ]"

2007-01-21 Thread Dr.Ruud
Rob Dixon schreef: > Dr.Ruud: >> Michael Alipio: >>> $log = "date=2007-01-12 blah blah"; >>> [...] >>> ($date) = $log =~ >>> /date=(\S+?)[\s+|,]/; >> >> /date=([0-9]{4}-[0-9]{2}-[0-9]{2})\b/; >> >> /date=([0-9]{4}(?:-[0-9]{2}){2})\b/; >> >> /date=([0-9-]{10})\b/; >> >>

Re: putting ";" as a replacement in the substitution.

2007-01-21 Thread Michael Alipio
- Original Message From: Ovid <[EMAIL PROTECTED]> To: beginners@perl.org Sent: Sunday, January 21, 2007 10:26:20 PM Subject: Re: putting ";" as a replacement in the substitution. --- Michael Alipio <[EMAIL PROTECTED]> wrote: > No, not correct. The regular expression is what's being

Global variable - No of hits counter

2007-01-21 Thread tom tom
Hi, In my mod_perl (Authentication module). I have global variable defined as follows use vars qw( $SESSION_CLEANUP_COUNTER); $SESSION_CLEANUP_COUNTER=0; my intention is to count no of times it is getting executed by clients (no of hits). I am incrementing it within Authenticate method as follo

Re: character classes vs regexp alternatives (using "( )" or "[ ]"

2007-01-21 Thread Jen Spinney
On 1/20/07, Michael Alipio <[EMAIL PROTECTED]> wrote: Hi, I'm a bit confused here: I have a regexp: ($date) = $log =~ /date=(\S+?)[\s+|,]/; so if I have: "date=2007-01-12 blah blah" or "date=2007-01-12,blah,blah" I was able to retrieve "2007-01-12" However, just recently after readin

Re: Could someone help me with this source code?

2007-01-21 Thread Tom Phoenix
On 1/20/07, Caduceus <[EMAIL PROTECTED]> wrote: I'm trying to run this perl script called "salter" on activestates komodo. I hope to use it with Mozilla Thunderbird. I've read Learning Perl, another perl book, went to perl.com, perl.org, pm.org, and cpan.com but nothing seems to help. I will s

Re: putting ";" as a replacement in the substitution.

2007-01-21 Thread Ovid
--- Michael Alipio <[EMAIL PROTECTED]> wrote: > I see... so in substitutions, all patterns in the left side are those that > have to be substituted, regardless of which is enclosed in parenthesis. Well, with a lot of hand-waving, then yes, that's basically correct. (There are exceptions, but tho

Re: character classes vs regexp alternatives (using "( )" or "[ ]"

2007-01-21 Thread Rob Dixon
Dr.Ruud wrote: Michael Alipio schreef: $log = "date=2007-01-12 blah blah"; [...] ($date) = $log =~ /date=(\S+?)[\s+|,]/; /date=([0-9]{4}-[0-9]{2}-[0-9]{2})\b/; /date=([0-9]{4}(?:-[0-9]{2}){2})\b/; /date=([0-9-]{10})\b/; /date=([0-9-]+)\b/; (untested)

Re: Date and time

2007-01-21 Thread Rob Dixon
M. Lewis wrote: > > Given the following code, if I were to want $day, $month, $hour, $minute > & $sec to have a leading zero (ie 01 for Jan rather than 1), is my only > option to use printf? Or is there a better way. > > What I'm searching for here is the *correct* method to get $day, $month, > et

Re: putting ";" as a replacement in the substitution.

2007-01-21 Thread Dr.Ruud
Michael Alipio schreef: > #I have this string: > > my $string = 'vd=root,status='; > > #Now, I want to transform it into: > > 'vd=root;status=' > > #That is replace the comma(,) between root and status with semicolon > (;); > > > $string =~ s/vd=\w+(,)/;/; > print $string,"\n"; > > #And it prints:

Re: putting ";" as a replacement in the substitution.

2007-01-21 Thread D. Bolliger
Michael Alipio am Sonntag, 21. Januar 2007 13:07: > D. Bolliger <[EMAIL PROTECTED]> > > Because everything matched - that is: vd=\w+(,) - is replaced with the > > semicolon. > > > > You seem to misunderstand the meaning of the capturing parenthesis '()' > > on the left part of the substitution: The

Re: Date and time

2007-01-21 Thread Dr.Ruud
"M. Lewis" schreef: > if I were to want $day, $month, $hour, > $minute & $sec to have a leading zero (ie 01 for Jan rather than 1), > is my only option to use printf? Or is there a better way. > > What I'm searching for here is the *correct* method to get $day, > $month, etc for uses like naming

Re: putting ";" as a replacement in the substitution.

2007-01-21 Thread Michael Alipio
- Original Message From: D. Bolliger <[EMAIL PROTECTED]> To: beginners@perl.org Sent: Sunday, January 21, 2007 7:43:19 PM Subject: Re: putting ";" as a replacement in the substitution. > Because everything matched - that is: vd=\w+(,) - is replaced with the > semicolon. > You seem to

Re: character classes vs regexp alternatives (using "( )" or "[ ]"

2007-01-21 Thread Dr.Ruud
Michael Alipio schreef: > $log = "date=2007-01-12 blah blah"; > [...] > ($date) = $log =~ > /date=(\S+?)[\s+|,]/; /date=([0-9]{4}-[0-9]{2}-[0-9]{2})\b/; /date=([0-9]{4}(?:-[0-9]{2}){2})\b/; /date=([0-9-]{10})\b/; /date=([0-9-]+)\b/; (untested) -- Affijn,

Re: maximum file size for while() loop?

2007-01-21 Thread D. Bolliger
David Moreno Garza am Sonntag, 21. Januar 2007 07:50: > On Sat, 2007-01-20 at 09:31 +1100, Ken Foskey wrote: > > > What's exactly the difference between: > > > ++$lines and $lines++; ? > > > > Nothing in this context. > > What about other contexts? Hi David #!/usr/bin/perl use strict; use warni

Re: putting ";" as a replacement in the substitution.

2007-01-21 Thread D. Bolliger
Michael Alipio am Sonntag, 21. Januar 2007 04:08: > Hi, Hi Michael > my $string = 'vd=root,status='; > > #Now, I want to transform it into: > 'vd=root;status=' > #That is replace the comma(,) between root and status with semicolon (;); > > $string =~ s/vd=\w+(,)/;/; > print $string,"\n"; > > #And

Re: Regexp in lookup differs in regexp in substitution (Re: putting ";" as a replacement in the substitution.)

2007-01-21 Thread Michael Alipio
- Original Message From: Michael Alipio <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Cc: begginers perl.org Sent: Sunday, January 21, 2007 7:11:47 PM Subject: Regexp in loopup differs in regexp in substitution (Re: putting ";" as a replacement in the substitution.) - Original Messa

Regexp in loopup differs in regexp in substitution (Re: putting ";" as a replacement in the substitution.)

2007-01-21 Thread Michael Alipio
- Original Message From: Ovid <[EMAIL PROTECTED]> To: Michael Alipio <[EMAIL PROTECTED]> Sent: Sunday, January 21, 2007 4:49:41 PM Subject: Re: putting ";" as a replacement in the substitution. --- Michael Alipio <[EMAIL PROTECTED]> wrote: > Hi, > > #I have this string: > > my $strin

Re: Date and time

2007-01-21 Thread Goksie
M. Lewis wrote: > > Given the following code, if I were to want $day, $month, $hour, > $minute & $sec to have a leading zero (ie 01 for Jan rather than 1), > is my only option to use printf? Or is there a better way. > > What I'm searching for here is the *correct* method to get $day, > $month, etc

Could someone help me with this source code?

2007-01-21 Thread Caduceus
Hi: I'm trying to run this perl script called "salter" on activestates komodo. I hope to use it with Mozilla Thunderbird. I've read Learning Perl, another perl book, went to perl.com, perl.org, pm.org, and cpan.com but nothing seems to help. I will show you the script. Any help will be apprecia

Re: maximum file size for while() loop?

2007-01-21 Thread David Moreno Garza
On Sat, 2007-01-20 at 09:31 +1100, Ken Foskey wrote: > > What's exactly the difference between: > > > > ++$lines; > > > > and > > > > $lines++; ? > > > Nothing in this context. What about other contexts? David. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:

Re: Date and time

2007-01-21 Thread Owen
On Sun, 21 Jan 2007 02:17:08 -0500 "M. Lewis" <[EMAIL PROTECTED]> wrote: > > Given the following code, if I were to want $day, $month, $hour, $minute > & $sec to have a leading zero (ie 01 for Jan rather than 1), is my only > option to use printf? Or is there a better way. Look at sprintf pe

Re: Date and time

2007-01-21 Thread John W. Krahn
M. Lewis wrote: > > Given the following code, if I were to want $day, $month, $hour, $minute > & $sec to have a leading zero (ie 01 for Jan rather than 1), is my only > option to use printf? Or is there a better way. > > What I'm searching for here is the *correct* method to get $day, $month, > e