transposing %d values to %x output

2011-03-29 Thread Noah Garrett Wallach
Hi there, s/(\d+)\.(\d+)\.(\d+)\.(\d+)/$1:$2:$3:$4::0/ so is there a slick, easily readable way to get the value $1, $2, $3, $4 to be rewriten as %x instead of a %d? Cheers, Noah -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@pe

Re: push and split

2009-09-17 Thread Noah Garrett Wallach
Chas. Owens wrote: On Thu, Sep 17, 2009 at 14:05, Noah Garrett Wallach wrote: Hi there, I am attempting to read a text file in to two array variables. --- text file --- hostname1 ip1 hostname2 ip2 --- text file --- so basically I would like to have the items in column become an the

matching multi occurrences or nothing

2009-09-17 Thread Noah Garrett Wallach
Hi there Perl folks, Okay I am trying to figure this out. I am trying to match the following: $line = "blah&blah&blah" so I have the following line to match that $line =~ /((?:blah).*?){0,5}/; But I want to capture "blah" in a variable like $capture = $1; or something like that? am I on

Re: push and split

2009-09-17 Thread Noah Garrett Wallach
Steve Bertrand wrote: Noah Garrett Wallach wrote: Hi there, I am attempting to read a text file in to two array variables. --- text file --- hostname1 ip1 hostname2 ip2 --- text file --- so basically I would like to have the items in column become an the elements of an array @routers and

push and split

2009-09-17 Thread Noah Garrett Wallach
Hi there, I am attempting to read a text file in to two array variables. --- text file --- hostname1 ip1 hostname2 ip2 --- text file --- so basically I would like to have the items in column become an the elements of an array @routers and then the items in column two in an array variable o

regexp question

2009-09-04 Thread Noah Garrett Wallach
Okay I am having troubles finding this. in the perldoc modules. Is there a slicker way to write the following? if ($line =~ /(Blah1)(.*)/) { $blah = $1 if $1; $blah2 = $2 if $2; } -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For ad

perldoc modules

2009-09-04 Thread Noah Garrett Wallach
Hi there, this might be obvious but how can I find a list of all the perldoc modules? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

perldoc output looks strange

2009-09-04 Thread Noah Garrett Wallach
Hi there, does anybody know why the perldoc output looks so strange on my mac? Here are the first few lines of 'perldoc perldoc' SYNOPSIS perldoc [###7m<88><92>^H###7m<88><92>h] [###7m<88><92>^H###7m<88><92>v] [###7m<88><92>^H###7m<88> <92>t] [###7m<88><92>^H###7m<88><92>u] [###7m<88>

hash of hashes values and keys

2009-09-04 Thread Noah Garrett Wallach
Hi there, I am trying to figure out how to use hash of hashes properly. can values and keys be at the same level? I am running in to troubles. Maybe values and keys cant be at the same level ? $policy{policy_statement}{$key} = 2; $policy{policy_statement}{$

Re: hash of hashes question

2009-09-04 Thread Noah Garrett Wallach
Patrick Dupre wrote: On Fri, 4 Sep 2009, Noah Garrett Wallach wrote: Hi there, I am having some trouble understanding hash of hashes here. I want to find all the keys for %policy{'policy_statement'} for my $line (@lines) { for my $key ( keys %policy{'p

hash of hashes question

2009-09-04 Thread Noah Garrett Wallach
Hi there, I am having some trouble understanding hash of hashes here. I want to find all the keys for %policy{'policy_statement'} for my $line (@lines) { for my $key ( keys %policy{'policy_statement'} ) { if ($line =~ /set\sprotocols\sbgp\sgroup\s(\S+)\s(import|exp

regexp question

2009-09-04 Thread Noah Garrett Wallach
Hi there, is there any way to search for the following text? In some cases the text that I am search could be "one-two-three-" or sometimes the text could be "one-two-" what is a nice easy why to parse the above - quotes not included. -- To unsubscribe, e-mail: beginners-unsubscr...@p

Search single scalar variable for Multiple matches

2009-09-02 Thread Noah Garrett Wallach
Hi there, what is the cleanest way to search a multi-line single scalar variable full of configuration information. I want match on specific criteria and then save a portion of the matched information in a hash or hashes variable. What is the best approach to doing this? Cheers, Noah --

Re: search replace saved to a variable

2009-09-02 Thread Noah Garrett Wallach
Jim Gibson wrote: At 7:22 PM -0700 9/2/09, Noah Garrett Wallach wrote: Hi there, what is the way to collapse this search/replace to one line? my $filename_cmd = $cmd[-1]; my $filename_cmd =~ s/\s/\./; (my $filename_cmd = $cmd[-1]) =~ s/\s/\./; thanks, okay a step further

search replace saved to a variable

2009-09-02 Thread Noah Garrett Wallach
Hi there, what is the way to collapse this search/replace to one line? my $filename_cmd = $cmd[-1]; my $filename_cmd =~ s/\s/\./; Cheers, Noah -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: ||= operator

2009-08-15 Thread Noah Garrett Wallach
Telemachus wrote: On Fri Aug 07 2009 @ 2:55, Admin wrote: Hi there, is there a page that explains the ||= operator and similar operators? google is not quite finding the special characters in the first 10 hits. Google and punctuation don't mix well, apparently. In any case, try perldoc perlo

Re: ||= operator

2009-08-15 Thread Noah Garrett Wallach
Shawn H. Corey wrote: Admin wrote: Hi there, is there a page that explains the ||= operator and similar operators? google is not quite finding the special characters in the first 10 hits. See http://perldoc.perl.org/perlop.html#Assignment-Operators the link is not helpful. there is no

Re: ||= operator

2009-08-15 Thread Noah Garrett Wallach
Chas. Owens wrote: On Mon, Aug 10, 2009 at 11:22, Bryan R Harris wrote: snip I think it's saying that just like: $a += 2; is the same as: $a = $a + 2; similarly: $a ||= 3; is the same as: $a = $a || 3; ... implying if $a is false, $a gets set to 3, otherwise it stays at whatever it w

Re: ||= operator

2009-08-15 Thread Noah Garrett Wallach
John W. Krahn wrote: Admin wrote: Hi there, Hello, is there a page that explains the ||= operator and similar operators? google is not quite finding the special characters in the first 10 hits. $left ||= $right is just short for: $left = $left || $right and || is the logical OR operator

Re: ||= operator

2009-08-15 Thread Noah Garrett Wallach
Chas. Owens wrote: On Fri, Aug 7, 2009 at 18:42, Admin wrote: Shawn H. Corey wrote: Admin wrote: Hi there, is there a page that explains the ||= operator and similar operators? google is not quite finding the special characters in the first 10 hits. See http://perldoc.perl.org/perlop.html#