Re: hash issues

2010-11-04 Thread Uri Guttman
> "JWK" == John W Krahn writes: JWK> Uri Guttman wrote: >>> "sw" == shawn wilson writes: >> sw> my $data; >> sw> while ( my $line = ) { >> sw> chomp ($line); sw> my @word = split / /, $line; >> >> sw> my $count = 0; sw> foreach my $aword ( @word ) { sw>

Re: hash issues

2010-11-04 Thread John W. Krahn
Uri Guttman wrote: "sw" == shawn wilson writes: sw> my $data; sw> while ( my $line = ) { sw> chomp ($line); sw> my @word = split / /, $line; sw> my $count = 0; sw> foreach my $aword ( @word ) { sw> $aword =~ tr/^[

Re: hash issues

2010-11-03 Thread Uri Guttman
> "sw" == shawn wilson writes: sw> 1. what's the reason for 'use warnings' instead of 'perl -w'? just sw> readability or is there something more? use warnings are lexical and affect only the file/scope they are in. -w is a global flag that affect all the code. if you use a module that is

Re: hash issues

2010-11-03 Thread shawn wilson
ok, i think i understand most of the documentation you sent (well, http://bobby-tables.com/ didn't work, but i read the rest). below is my modified code (i'm hoping it is better than the code i posted before as that might mean that i possibly learned something :) ). i also have a couple questions:

Re: hash issues

2010-11-03 Thread Shlomi Fish
Hi Shawn, On Wednesday 03 November 2010 16:25:09 shawn wilson wrote: > hummm, i'm still having issues with these references. i'm hoping someone > might see some flaw in my syntax or logic that might be easily corrected. > so, here is what i have in all it's glory. what i want for output is return

Re: hash issues

2010-11-03 Thread shawn wilson
hummm, i'm still having issues with these references. i'm hoping someone might see some flaw in my syntax or logic that might be easily corrected. so, here is what i have in all it's glory. what i want for output is return a csv with: search term,string from db,lines from input search string came f

Re: hash issues

2010-11-03 Thread Paul Johnson
On Wed, Nov 03, 2010 at 06:03:11AM -0700, John W. Krahn wrote: > Shlomi Fish wrote: > > > >2. You are trying to iterate over %{$data{$word}} in two nested loops. This > >will confuse Perl to no end. > > No it will not. Perl will know exactly what to do. Yes, perl will do exactly what it was aske

Re: hash issues

2010-11-03 Thread John W. Krahn
Shlomi Fish wrote: On Wednesday 03 November 2010 09:27:14 shawn wilson wrote: i'm getting errors when trying to print these hash refs out and i just can't figure it out. here's the function: for my $word ( keys %data ) { while( my ($field, $type) = each %{ $data }{ $word } ) { print

Re: hash issues

2010-11-03 Thread Shlomi Fish
Hi Shawn, On Wednesday 03 November 2010 09:27:14 shawn wilson wrote: > i'm getting errors when trying to print these hash refs out and i just > can't figure it out. here's the function: > > for my $word ( keys %data ) { >while( my ($field, $type) = each %{ $data }{ $word } ) { > print "

hash issues

2010-11-03 Thread shawn wilson
i'm getting errors when trying to print these hash refs out and i just can't figure it out. here's the function: for my $word ( keys %data ) { while( my ($field, $type) = each %{ $data }{ $word } ) { print "$word,$field" if( $type eq 'field' ); while( my ($line, $type) = each %{ $da

Re: Archive::Zip and hash issues

2006-09-14 Thread Mumia W.
On 09/14/2006 09:20 AM, Derek B. Smith wrote: [...] sub zipit { ##-- Add all readable files below $oldir --## ##-- and write them into a file. --## my $zip = Archive::Zip->new(); my $entry = $zip->addDirectory ("$oldir/$word/") or die "Failed to add file for archive zip $!"; $entry->de

Re: Archive::Zip and hash issues

2006-09-14 Thread Derek B. Smith
--- Tom Phoenix <[EMAIL PROTECTED]> wrote: > On 9/14/06, Derek B. Smith > <[EMAIL PROTECTED]> wrote: > > > my %subdir_for = ( > > 'bpjava\-msvc' => 23, > > 'bpjava\-susvc' => 24, > > 'bpjava\-usvc'=> 25, > > ) > > Those backslashes aren't doing anything. But they > aren't needed, > e

Re: Archive::Zip and hash issues

2006-09-14 Thread Tom Phoenix
On 9/14/06, Derek B. Smith <[EMAIL PROTECTED]> wrote: my %subdir_for = ( 'bpjava\-msvc' => 23, 'bpjava\-susvc' => 24, 'bpjava\-usvc'=> 25, ) Those backslashes aren't doing anything. But they aren't needed, either; hyphen isn't a special character in a hash key or single-quoted stri

Archive::Zip and hash issues

2006-09-14 Thread Derek B. Smith
I need some help in this again. Firt I built a hash consisting of 52 unique subdir names, but 3 of these sub-dirs have a dash like so bpjava-msvc. During the translation is the coorect way to ignore the by using the \? my %subdir_for = ( 'bpjava\-msvc' => 23, 'bpjava\-susvc' => 24, 'bpja