RE: another doggone newbie question about hash fiddling...

2007-12-04 Thread Jan Dubois
On Tue, 04 Dec 2007, Justin Allegakoen wrote: > --8<--- > Note that you can have a lexical $_ in 5.10: > > foreach my $_ ( @foo ) { >s/SID/12345/; > } > --8<--- > > A! Why is that considered a good feature to add to 5.1

RE: another doggone newbie question about hash fiddling...

2007-12-04 Thread Justin Allegakoen
--8<--- Note that you can have a lexical $_ in 5.10: foreach my $_ ( @foo ) { s/SID/12345/; } --8<--- A! Why is that considered a good feature to add to 5.10? Sure scoping and all, but do the other perlvars behave the s

RE: another doggone newbie question about hash fiddling...

2007-12-04 Thread Justin Allegakoen
--8<--- Note that you can have a lexical $_ in 5.10: foreach my $_ ( @foo ) { s/SID/12345/; } --8<--- A! Why is that considered a good feature to add to 5.10? Sure scoping and all, but do the other perlvars behave the s

RE: another doggone newbie question about hash fiddling...

2007-12-04 Thread Jan Dubois
On Tue, 04 Dec 2007, [EMAIL PROTECTED] wrote: > It's also a cautionary tale - if you're using the default "$_" in for > loops, you can munge your original data. > foreach my $foo ( @foo ) { >$foo =~ s/SID/12345/; > } > > this doesn't mess w/ @foo. That is not correct; it will still modify @fo

RE: another doggone newbie question about hash fiddling...

2007-12-04 Thread Andy_Bach
> English to perl translation: s/SID/12345/ for values %foo; Nice - this takes advantage of the fact that $_ here is a reference to the actual value of the hash so that the subst. works directly on the hash. The same fact works for arrays too @foo = ('abc/SID/def', 'bcd/SID/fgh', 'hjk/SID/op

Re: another doggone newbie question about hash fiddling...

2007-12-04 Thread Andy_Bach
my %foo = ( '01' => 'abc/SID/def', '02' => 'bcd/SID/fgh', '03' => 'hjk/SID/opq' ); to $foo{'01'} = 'abc/12345/def'; $foo{'02'} = 'bcd/12345/fgh'; $foo{'03'} = 'hjk/12345/opq'; $foo{$_} =~ s/SID/12345/ for keys %foo; a Andy Bach Systems

RE: another doggone newbie question about hash fiddling...

2007-12-04 Thread Jan Dubois
You said: "I want to replace the text 'SID' in each value of the hash with the text '12345'". English to perl translation: s/SID/12345/ for values %foo; Cheers, -Jan From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: December 4, 2007 11:56 AM To

Re: another doggone newbie question about hash fiddling...

2007-12-04 Thread Deane . Rothenmaier
William, That's what I was looking for! Thanks a heap!! Deane Rothenmaier Programmer/Analyst Walgreens Corp. 847-914-5150 Let us permit nature to have her way; she understands her business better than we do. -- Michel de Montaigne___ ActivePerl maili

another doggone newbie question about hash fiddling...

2007-12-04 Thread Deane . Rothenmaier
Gurus, I'm embarrassed to have to ask this, but my books don't mention it, and neither does perldoc. I'm looking for a way to do a substitution to all values of a hash in one line, something using, oh, grep, or map... What I want to do is change the values of this hash: my %foo = ( '01' => '

RE: "Quality Percentage" of hashes as reported by Devel::Peek

2007-12-04 Thread Deane . Rothenmaier
Thanks to all who answered, but Mr. Dubos provided the guts of the question--he sent some source code that explained it all. Thanks again! Deane Rothenmaier Programmer/Analyst Walgreens Corp. 847-914-5150 Let us permit nature to have her way; she understands her business better than we do. --

RE: "Quality Percentage" of hashes as reported by Devel::Peek

2007-12-04 Thread Brian Raven
Sean Tobin <> wrote: > Could you clarify a bit more on what you mean by hash quality and > expected comparisons? I took a look at the devel::peek module, > specifically the outputs of its dump function and I couldn't find > what you were looking for. It sounds like you are attempting to > implement

RE: "Quality Percentage" of hashes as reported by Devel::Peek

2007-12-04 Thread Brian Raven
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 03 December 2007 18:28 To: activeperl@listserv.ActiveState.com Subject: "Quality Percentage" of hashes as reported by Devel::Peek > Gurus, > > I tried directing this query to the module's author, but the e-mai