Re: searching keys

2008-07-24 Thread John W. Krahn
Noah wrote: okay I have a strange issue. all the lines as part of "my @lines = keys %ip;" have a space at the beginning of the line of each key. perldoc -q "Why do I get weird spaces when I print an array of lines?" John -- Perl isn't a toolbox, but a small machine shop where you can speci

Re: searching keys

2008-07-24 Thread Mr. Shawn H. Corey
On Thu, 2008-07-24 at 10:06 -0400, yitzle wrote: > On Thu, Jul 24, 2008 at 12:44 AM, Noah <[EMAIL PROTECTED]> wrote: > > > > Hi there, > > > > okay I have a strange issue. all the lines as part of "my @lines = keys > > %ip;" have a space at the beginning of the line of each key. > > > > cheers, >

Re: searching keys

2008-07-24 Thread yitzle
On Thu, Jul 24, 2008 at 1:02 AM, Noah <[EMAIL PROTECTED]> wrote: > >> >> Untested code. >> >> # Always... >> use strict; >> use warnings; >> >> my %ip = ...; >> >> #Get the lines as an array. >> my @lines = keys %ip; >> >> # Slight modification to the regex. Someone else's reply will probably >> ha

Re: searching keys

2008-07-24 Thread yitzle
On Thu, Jul 24, 2008 at 12:44 AM, Noah <[EMAIL PROTECTED]> wrote: > > Hi there, > > okay I have a strange issue. all the lines as part of "my @lines = keys > %ip;" have a space at the beginning of the line of each key. > > cheers, > > Noah Without knowing how %ip was formed or how you are decidin

Re: searching keys

2008-07-23 Thread Noah
Untested code. # Always... use strict; use warnings; my %ip = ...; #Get the lines as an array. my @lines = keys %ip; # Slight modification to the regex. Someone else's reply will probably have a more elegant method. my $ipSearch = qr/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/; # Use v

Re: searching keys

2008-07-23 Thread Noah
yitzle wrote Untested code. # Always... use strict; use warnings; my %ip = ...; #Get the lines as an array. my @lines = keys %ip; # Slight modification to the regex. Someone else's reply will probably have a more elegant method. my $ipSearch = qr/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,

Re: searching keys

2008-07-23 Thread Noah
Noah Untested code. # Always... use strict; use warnings; my %ip = ...; #Get the lines as an array. my @lines = keys %ip; # Slight modification to the regex. Someone else's reply will probably have a more elegant method. my $ipSearch = qr/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/;

Re: searching keys

2008-07-23 Thread yitzle
On Thu, Jul 24, 2008 at 3:59 AM, Noah <[EMAIL PROTECTED]> wrote: > > Hi there, > > I loaded a bunch of configuration lines into a hash called $Input > now I am searching the hash to make sure specific lines are there. > > I want to print "NO" unless there is a match to the following ""check $ip > h

searching keys

2008-07-23 Thread Noah
Hi there, I loaded a bunch of configuration lines into a hash called $Input now I am searching the hash to make sure specific lines are there. I want to print "NO" unless there is a match to the following ""check $ip here"; but $ip could be the range as shown below. so a key like "check 2.2