Stuck on a hash referrence, kinda

2007-05-12 Thread Mathew Snyder
A subroutine I'm working on takes two hash references. The hashes are each actually a HoH. timesheet(\%opsTotal, \%opsEnvTotal); The problem I'm having is that I need to look past the first hash and into the second for the existence of a particular key. I'm not sure how to go about doing this.

Re: About a reg expression ?:

2007-05-12 Thread yitzle
Correction: Will not match "a cat" That requires: m/a (?:black|grey|white)? cat/; On 5/13/07, yitzle <[EMAIL PROTECTED]> wrote: To add to John: m/a (?:black|grey|white) cat/; Will match one of these: - "a black cat" - "a grey cat" - "a white cat" - "a cat" (please note two spaces) The lead

Re: About a reg expression ?:

2007-05-12 Thread yitzle
To add to John: m/a (?:black|grey|white) cat/; Will match one of these: - "a black cat" - "a grey cat" - "a white cat" - "a cat" (please note two spaces) The leading double astrix confuses me. A '*' after a pattern will match the pattern 0 or more times. ** means nothing to me. On 5/13/07, John

Re: About a reg expression ?:

2007-05-12 Thread John W. Krahn
小楊 wrote: > Does anyone know the following syntax's meaning or usage? > > Can anyone help me to understand this syntax? Or if available, can anyone > provide me some useful example to understand more? > > Thank you all that help me. > > The syntax is as follow: > > */**a (?:black|grey|white) ca

Re: About a reg expression ?:

2007-05-12 Thread Chas Owens
On 5/12/07, 小楊 <[EMAIL PROTECTED]> wrote: Does anyone know the following syntax's meaning or usage? Can anyone help me to understand this syntax? Or if available, can anyone provide me some useful example to understand more? Thank you all that help me. The syntax is as follow: */**a (?:black|

About a reg expression ?:

2007-05-12 Thread 小楊
Does anyone know the following syntax's meaning or usage? Can anyone help me to understand this syntax? Or if available, can anyone provide me some useful example to understand more? Thank you all that help me. The syntax is as follow: */**a (?:black|grey|white) cat/*

Re: $1 $2 var confusion

2007-05-12 Thread Mumia W.
On 05/12/2007 07:00 PM, Rob Dixon wrote: [...] No, it has no effect on $1. I thought it would cause confusion! The statement simply assigns a list to @f. The first element of the list is undef, and the rest is the result of applying the regex to $email, so it's the same as my @f = (undef);

Re: $1 $2 var confusion

2007-05-12 Thread Rob Dixon
Steve Bertrand wrote: John W. Krahn wrote: Mumia W. wrote: That happens because the match variables ($1, $2, ...) are only changed when a regular expression matches; otherwise, they are left alone. In the first case, "$2 !~ /domain\.com/" succeeds but does not capture anything, so the numbered

Re: $1 $2 var confusion

2007-05-12 Thread Steve Bertrand
John W. Krahn wrote: > Mumia W. wrote: >> That happens because the match variables ($1, $2, ...) are only changed >> when a regular expression matches; otherwise, they are left alone. >> >> In the first case, "$2 !~ /domain\.com/" succeeds but does not capture >> anything, so the numbered match var

Re: $1 $2 var confusion

2007-05-12 Thread Rob Dixon
John W. Krahn wrote: Mumia W. wrote: That happens because the match variables ($1, $2, ...) are only changed when a regular expression matches; otherwise, they are left alone. In the first case, "$2 !~ /domain\.com/" succeeds but does not capture anything, so the numbered match variables are un

Re: $1 $2 var confusion

2007-05-12 Thread John W. Krahn
Mumia W. wrote: > > That happens because the match variables ($1, $2, ...) are only changed > when a regular expression matches; otherwise, they are left alone. > > In the first case, "$2 !~ /domain\.com/" succeeds but does not capture > anything, so the numbered match variables are unset. > > Y

Re: $1 $2 var confusion

2007-05-12 Thread Steve Bertrand
> That happens because the match variables ($1, $2, ...) are only changed > when a regular expression matches; otherwise, they are left alone. > > In the first case, "$2 !~ /domain\.com/" succeeds but does not capture > anything, so the numbered match variables are unset. > > Your situation reinf

Re: $1 $2 var confusion

2007-05-12 Thread Steve Bertrand
> But are you really trying to do something like validate an email > address? They're more complex than you may realize. (For example, > there may be more than one '@' sign in an e-mail address.) Maybe > there's a module on CPAN that could help you with whatever you're > doing. Thanks for your inp

Re: $1 $2 var confusion

2007-05-12 Thread Steve Bertrand
> From perldoc perlre: > >The numbered match variables ($1, $2, $3, etc.) and the related >punctuation set ($+, $&, $`, $', and $^N) are all dynamically scoped >until the end of the enclosing block or until the next successful match, >whichever comes first. > > In your first examp

Re: $1 $2 var confusion

2007-05-12 Thread Mumia W.
On 05/12/2007 09:21 AM, Steve Bertrand wrote: I have two scenarios here, and in the first one, I am not seeing the logic I would normally expect. I'll compact the code as to save everyone from scrolling. I have strict and warnings enabled (as I always do). Can someone tell me why in the first c

Re: $1 $2 var confusion

2007-05-12 Thread Tom Phoenix
On 5/12/07, Steve Bertrand <[EMAIL PROTECTED]> wrote: my $email = '[EMAIL PROTECTED]'; $email =~ /(.*)@(.*)/; if ($2 !~ /domain\.com/) { print "var 2 is bad\n"; } print "$1\n"; At this point, what is $1? It's the value from the last successful pattern match. But was that the test again

Re: $1 $2 var confusion

2007-05-12 Thread Rob Dixon
Steve Bertrand wrote: I have two scenarios here, and in the first one, I am not seeing the logic I would normally expect. I'll compact the code as to save everyone from scrolling. I have strict and warnings enabled (as I always do). Can someone tell me why in the first case $1 isn't initialized a

$1 $2 var confusion

2007-05-12 Thread Steve Bertrand
I have two scenarios here, and in the first one, I am not seeing the logic I would normally expect. I'll compact the code as to save everyone from scrolling. I have strict and warnings enabled (as I always do). Can someone tell me why in the first case $1 isn't initialized and in the second case it

Re: regex & utf8

2007-05-12 Thread Dr.Ruud
Tom Allison schreef: > Ruud: >> Tom: >>> Under perl version 5.8, does /(\w+)/ match UTF-8 characters without >>> calling any special pragma? >> >> Yes, but only if your data is proper. Mind that any ASCII-character >> is a UTF-8 character too (U+ .. U+007F). > >>> So I'm trying to see if I ca

Re: regex & utf8

2007-05-12 Thread Tom Allison
Rather than going through the somewhat buggy process of trying to determine which of the many character sets there are, is there some way that I can just universally convert everything into UTF8? I can open a file with a :utf8 declaration when creating the file handle. But do I need to do

[OT] Please uns*bscribe [EMAIL PROTECTED]

2007-05-12 Thread Dr.Ruud
Please uns*bscribe [EMAIL PROTECTED] to free us from their silly bounces. (I sent this to [EMAIL PROTECTED] before, but got no reaction.) -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.pe

Re: yet another regex

2007-05-12 Thread Dr.Ruud
Corrected header line: Newsgroups: perl.beginners,perl.beginners Chas Owens wrote: > In all of the corrections I totally missed that I had left caps-lock > on after the LOOP tag. Sigh, I obviously need more caffeine. I also > could not remember if the print was in a continue block or not.

Re: regex & utf8

2007-05-12 Thread Dr.Ruud
Tom Allison schreef: > Under perl version 5.8, does /(\w+)/ match UTF-8 characters without > calling any special pragma? Yes, but only if your data is proper. Mind that any ASCII-character is a UTF-8 character too (U+ .. U+007F). > So I'm trying to see if I can just use /(\w+)/ without worr

Re: passing two hashes into a subroutine

2007-05-12 Thread Mathew Snyder
If I'm working with two hashes which are actually HoH how would that work? This is the snippet of code I'm working with: sub timesheet { my ($dept, $env) = @_; if (exists $dept->{username}) { open TIMESHEET, ">/work_reports/user/ops_timesheet_weekof_$endDate.txt";

Re: regexp ...

2007-05-12 Thread Ken Foskey
On Fri, 2007-05-11 at 10:46 -0700, oryann9 wrote: > > > > Funny I had to explain split /|/, $str returning an > > array of characters. > > > > -- > > Ken Foskey > > FOSS developer > > > > Excellent Ken, > > thank you, but why the pipe | and how does this differ > from ' ' or \s+. I used Dump