Re: hash help !

2012-11-16 Thread jet speed
On Thu, Nov 15, 2012 at 10:06 PM, Chris Charley wrote: > > > "jet speed" wrote in message news:CAG1VzcezebNiFar3YKep- > > What i am trying to do ? >> I want to match the entries from file1.txt with file.txt, if matches then >> print the key and value. some will have multiple entries as in the ou

Re: hash help !

2012-11-15 Thread Chris Charley
"jet speed" wrote in message news:CAG1VzcezebNiFar3YKep- What i am trying to do ? I want to match the entries from file1.txt with file.txt, if matches then print the key and value. some will have multiple entries as in the output. required output 10.00.00.00.aa.56.9b.7a 22:5a 10.00.00.00.

Re: hash help !

2012-11-15 Thread Chris Charley
"jet speed" wrote in message news:CAG1VzcezebNiFar3YKep- What i am trying to do ? I want to match the entries from file1.txt with file.txt, if matches then print the key and value. some will have multiple entries as in the output. required output 10.00.00.00.aa.56.9b.7a 22:5a 10.00.00.00.

Re: hash help !

2012-11-15 Thread Chris Charley
"jet speed" wrote in message news:CAG1VzcezebNiFar3YKep- What i am trying to do ? I want to match the entries from file1.txt with file.txt, if matches then print the key and value. some will have multiple entries as in the output. required output 10.00.00.00.aa.56.9b.7a 22:5a 10.00.00.00.

Re: hash help !

2012-11-15 Thread Jim Gibson
On Nov 15, 2012, at 8:40 AM, jet speed wrote: > On Thu, Nov 15, 2012 at 2:49 PM, jet speed wrote: > >> On Thu, Nov 15, 2012 at 11:43 AM, Charles DeRykus wrote: >> >> Thanks Charles, >> >> What i am trying to do ? >> I want to match the entries from file1.txt with file.txt, if matches then >>

Re: hash help !

2012-11-15 Thread jet speed
On Thu, Nov 15, 2012 at 2:49 PM, jet speed wrote: > > > On Thu, Nov 15, 2012 at 11:43 AM, Charles DeRykus wrote: > >> On Thu, Nov 15, 2012 at 2:46 AM, jet speed >> > ... >> > I was able to build the hash, however the file contains approx 10,000 >> > entries. but while i print the hash i get on

Re: hash help !

2012-11-15 Thread jet speed
On Thu, Nov 15, 2012 at 11:43 AM, Charles DeRykus wrote: > On Thu, Nov 15, 2012 at 2:46 AM, jet speed > > ... > > I was able to build the hash, however the file contains approx 10,000 > > entries. but while i print the hash i get only approx 1300 lines or > > key=>values. > > > > i guess its

Re: hash help !

2012-11-15 Thread Charles DeRykus
On Thu, Nov 15, 2012 at 2:46 AM, jet speed > ... > I was able to build the hash, however the file contains approx 10,000 > entries. but while i print the hash i get only approx 1300 lines or > key=>values. > > i guess its because, the file has duplicate entries. example below > > file.txt >>

Re: hash help !

2012-11-15 Thread David Precious
On Thu, 15 Nov 2012 10:46:34 + jet speed wrote: > I was able to build the hash, however the file contains approx > 10,000 entries. but while i print the hash i get only approx 1300 > lines or key=>values. > > i guess its because, the file has duplicate entries. example below [...] > How

Re: hash help !

2012-11-15 Thread Dr.Ruud
On 2012-11-15 11:46, jet speed wrote: 22:5a => 10.00.00.00.aa.56.9b.7a 22:5a => 10.00.00.00.aa.57.99.8a 32:9c => 10.00.00.00.aa.46.9b.33 a2:cc => 10.00.00.00.aa.5a.9b.63 a5:cc => 10.00.00.00.aa.5a.9b.63 b2:cc => 10.00.00.00.aa.5a.9b.63 How do i build all the entries into

Re: hash help !

2012-11-15 Thread jet speed
On Thu, Nov 15, 2012 at 8:46 AM, Dr.Ruud wrote: > On 2012-11-15 03:07, Uri Guttman wrote: > > my %hash = read_file( 'file.txt' ) =~ /^(.+)\s*=>\s*(.+)$/mg ; >> > > Trailing whitespace in the keys? Skipping empty values? > > my %kv= read_file( 'file.txt' ) =~ /^(.+?)\s*=>\s*(.*)/mg; > > an

Re: hash help !

2012-11-15 Thread Dr.Ruud
On 2012-11-15 03:07, Uri Guttman wrote: my %hash = read_file( 'file.txt' ) =~ /^(.+)\s*=>\s*(.+)$/mg ; Trailing whitespace in the keys? Skipping empty values? my %kv= read_file( 'file.txt' ) =~ /^(.+?)\s*=>\s*(.*)/mg; and without File::Slurp: my %kv= map m/(.+?)\s*=>\s*(.*)/, <$fh>

Re: hash help !

2012-11-14 Thread Uri Guttman
On 11/14/2012 05:45 PM, Charles DeRykus wrote: On Wed, Nov 14, 2012 at 9:05 AM, jet speed wrote: Hi Is there a way, i can build an %hash from a file as Input. Appreciate you help with this. file.txt 22:5a => 10.00.00.00.aa.56.9b.7a 32:9c => 10.00.00.00.aa.46.9b.33 a2:cc=> 10.

Re: hash help !

2012-11-14 Thread Charles DeRykus
On Wed, Nov 14, 2012 at 9:05 AM, jet speed wrote: > Hi > Is there a way, i can build an %hash from a file as Input. Appreciate you > help with this. > > file.txt > > > 22:5a => 10.00.00.00.aa.56.9b.7a > 32:9c => 10.00.00.00.aa.46.9b.33 > a2:cc=> 10.00.00.00.aa.5a.9b.63 Assuming n

Re: hash help !

2012-11-14 Thread Nathan Hilterbrand
On 11/14/2012 12:05 PM, jet speed wrote: Hi Is there a way, i can build an %hash from a file as Input. Appreciate you help with this. file.txt 22:5a => 10.00.00.00.aa.56.9b.7a 32:9c => 10.00.00.00.aa.46.9b.33 a2:cc=> 10.00.00.00.aa.5a.9b.63 Thanks Sj J.S.: Thought of two

Re: hash help !

2012-11-14 Thread Andy Bach
On Wed, Nov 14, 2012 at 11:05 AM, jet speed wrote: > > file.txt > > > 22:5a => 10.00.00.00.aa.56.9b.7a > 32:9c => 10.00.00.00.aa.46.9b.33 > a2:cc=> 10.00.00.00.aa.5a.9b.63 Er, read it in, line by line, chomp, split on something like my ($key, $value) = split(/\s*=>\s*/); and b

Re: hash help !

2012-11-14 Thread Brock
That is the content of your file, with those ' => ' and everything? You should describe what you want the resulting %hash to contain, using the example file you provided. --Brock On 2012.11.14.17.05, jet speed wrote: > Hi > Is there a way, i can build an %hash from a file as Input. Appreciate yo

Re: Hash Help Needed !

2004-03-25 Thread R. Joseph Newton
"Normandin, Jason" wrote: > Hi > > I am scoping the %response_values hash at the top. I dont understand why it > would need to be temporary as I am referancing that hash outside of the loop > when I iterate through. > > I changed the syntax to referance the oids rather then the hash name and I >

Re: Hash Help Needed !

2004-03-25 Thread R. Joseph Newton
[EMAIL PROTECTED] wrote: > foreach my $response ($record->{keys %response_values} ) What is this? It looks like you are trying to use a list as a hash key. I don't think that is going to work. A hash element should take a scalar as its key, not a list: Greetings! C:\Documen

RE: Hash Help Needed !

2004-03-25 Thread Guay Jean-Sébastien
Hello Jason, > $VAR1 = { > 'oids' => '%response_values', > 'time' => '03/25/2004 03:16:39' > }; ... > If so, what is wrong with my assignment statement ? > > push @{$response_hash{$request_id}},{time => "$time",oids => > "%response_values"}; That is exactly what Charl

RE: Hash Help Needed !

2004-03-25 Thread Normandin, Jason
How can I get the oids=> to populate the oids object with the vals ? Thanks Jason -Original Message- From: Charles K. Clarkson [mailto:[EMAIL PROTECTED] Sent: Thursday, March 25, 2004 10:35 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: Normandin, Jason Subject: RE: Hash H

RE: Hash Help Needed !

2004-03-25 Thread Normandin, Jason
is point :( = Jason -Original Message- From: Wiggins d Anconia [mailto:[EMAIL PROTECTED] Sent: Thursday, March 25, 2004 10:45 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; Normandin, Jason Subject: RE: Hash Help Needed ! > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: [snip] &

RE: Hash Help Needed !

2004-03-25 Thread Normandin, Jason
IL PROTECTED] Cc: Normandin, Jason Subject: RE: Hash Help Needed ! [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: : : I have run into a situation that I am unclear on. : : I am making the following assignment during a loop: : : push @{$response_hash{$request_id}},{time => "$time"

RE: Hash Help Needed !

2004-03-25 Thread Wiggins d Anconia
Please bottom post > Hi > > I am scoping the %response_values hash at the top. I dont understand why it > would need to be temporary as I am referancing that hash outside of the loop > when I iterate through. > It doesn't have to be temporary, but you overstep the help that 'strict' would

Re: RE: Hash Help Needed !

2004-03-25 Thread jason_normandin
Got it. I missed your note on the whitespace. Thanks everyone !! > > From: "Charles K. Clarkson" <[EMAIL PROTECTED]> > Date: 2004/03/25 Thu PM 03:35:08 GMT > To: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> > CC: <[EMAIL PROTECTED]> > Subject: R

RE: Hash Help Needed !

2004-03-25 Thread Wiggins d Anconia
> [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: [snip] > : > : print "Time : $record->{time}\n"; > : print "IP : $record->{ip_addr}\n"; > : foreach my $response ($record->{keys %response_values} ) In addition to what Charles already stated, once you have c

RE: Hash Help Needed !

2004-03-25 Thread Charles K. Clarkson
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: : : I have run into a situation that I am unclear on. : : I am making the following assignment during a loop: : : push @{$response_hash{$request_id}},{time => "$time",ip_addr : => "$ip_address",oids => "%response_values"}; I didn't test your cod

Re: Hash help

2001-05-04 Thread Timothy Kimball
: I declare my hash like this: : : my ( %FS_XCPTN ); # hash table, key is mount point, : # value is FS's special case H_LIMIT and : C_LIMIT : : I use it like this: : $FS_XCPTN{$mntPoint} = { :

Re: Hash help

2001-05-04 Thread Jos I Boumans
In the 2nd case your addressing your hash as a hash REFERENCE, which makes a big difference i suggest you read up on references at http://language.perl.com/newdocs/pod/perlreftut.html either way, your first method works fine and should work in most cases. however, if you want to pass said hash t