Re: Match Hash Key's with Array elements

2013-12-13 Thread jet speed
Thanks - Shaji, Uri and Shawn for your valuable inputs. Apprecaite it. Cheers ! On Fri, Dec 13, 2013 at 3:33 PM, Uri Guttman wrote: > On 12/13/2013 10:21 AM, Shaji Kalidasan wrote: > >> Greetings, >> >> Thanks a bunch Uri and Shawn for providing valuable inputs. >> >> Here is the optimized c

Re: Match Hash Key's with Array elements

2013-12-13 Thread Uri Guttman
On 12/13/2013 10:21 AM, Shaji Kalidasan wrote: Greetings, Thanks a bunch Uri and Shawn for providing valuable inputs. Here is the optimized code after corrections (based on inputs from Uri and Shawn) [code] use strict; use warnings; my %complex_hash; my @ex = qw / 5326 2041 1391 1439 x1259

Re: Match Hash Key's with Array elements

2013-12-13 Thread Shaji Kalidasan
Greetings, Thanks a bunch Uri and Shawn for providing valuable inputs. Here is the optimized code after corrections (based on inputs from Uri and Shawn) [code] use strict; use warnings; my %complex_hash;   my @ex = qw / 5326 2041 1391 1439  x1259 /;   open my $fh, "<", "fullhost.txt" or die $!

Re: Match Hash Key's with Array elements

2013-12-13 Thread Uri Guttman
On 12/13/2013 10:09 AM, Shawn H Corey wrote: On Fri, 13 Dec 2013 10:01:13 -0500 Uri Guttman wrote: open my $fh, "<", "fullhost.txt" or die $!; while (<$fh>) { while( my $line = <$fh> ) { chomp; chomp $line; yep! uri -- Uri Guttman - The Perl Hunter The Best Perl Jobs, The

Re: Match Hash Key's with Array elements

2013-12-13 Thread Shawn H Corey
On Fri, 13 Dec 2013 10:01:13 -0500 Uri Guttman wrote: > > open my $fh, "<", "fullhost.txt" or die $!; > > while (<$fh>) { > > while( my $line = <$fh> ) { > > chomp; chomp $line; > > my $line = $_; > > no need to copy $_ as the while did it. -- Don't stop where the ink doe

Re: Match Hash Key's with Array elements

2013-12-13 Thread Uri Guttman
On 12/13/2013 07:43 AM, Shaji Kalidasan wrote: Greetings, Here is one way to do it. Please note that I have retained your variable naming conventions and style instead of inventing my own. [code] use strict; use warnings; my %complex_hash; my @ex = qw / 5326 2041 1391 1439 x1259 /; open my

Re: Match Hash Key's with Array elements

2013-12-13 Thread Shaji Kalidasan
Greetings, Here is one way to do it. Please note that I have retained your variable naming conventions and style instead of inventing my own. [code] use strict; use warnings; my %complex_hash;   my @ex = qw / 5326 2041 1391 1439  x1259 /;   open my $fh, "<", "fullhost.txt" or die $!; while (<$f

Match Hash Key's with Array elements

2013-12-13 Thread jet speed
Dear All, I have sample code below, i am trying print the matching array element values sorted in the hash. As you would notice only one of the array element "x1259" will print its value "IDT" stored in the hash. Please could you advice how can i get rest of the array elements matched in the has