Re: search and replace

2012-08-17 Thread Irfan Sayed
thanks a lot regards irfan From: Shawn H Corey To: beginners@perl.org Cc: Irfan Sayed Sent: Saturday, August 18, 2012 6:50 AM Subject: Re: search and replace On Fri, 17 Aug 2012 18:02:23 -0700 (PDT) Irfan Sayed wrote: > i have string like this : > $a

Re: search and replace

2012-08-17 Thread Shawn H Corey
On Fri, 17 Aug 2012 18:02:23 -0700 (PDT) Irfan Sayed wrote: > i have string like this : > $a = '$(workspace)\convergence\trunk'; > > i need to replace $(workspace) with 'c:\p4\abc' > i wrote regex like this : > > $a =~ s/$\(workspace)/c:\\p4\\abc/; The easy way is to quote it: $a =~ s/\Q$

search and replace

2012-08-17 Thread Irfan Sayed
hi, i have string like this : $a = '$(workspace)\convergence\trunk'; i need to replace $(workspace) with 'c:\p4\abc' i wrote regex like this : $a =~ s/$\(workspace)/c:\\p4\\abc/; however, the string which i am getting is : $(c:\p4\abc)\convergence\trunk i need output like this : c:\p4\abc\conv

Re: syntax question conc​erning Rex::Commands​::Iptables perldoc s​ynopsis​

2012-08-17 Thread Dominik Danter
Andy Bach hat am 17. August 2012 um 22:12 geschrieben: > On Fri, Aug 17, 2012 at 2:49 PM, Andy Bach wrote: > > So try starting the test script w/.: > > use Rex; > > use Rex::Commands::Iptables; > > Nope - sort of the other way round, 'rex' is an executable program > that, like perl, you use t

Re: syntax question conc​erning Rex::Commands​::Iptables perldoc s​ynopsis​

2012-08-17 Thread Andy Bach
On Fri, Aug 17, 2012 at 2:49 PM, Andy Bach wrote: > So try starting the test script w/.: > use Rex; > use Rex::Commands::Iptables; Nope - sort of the other way round, 'rex' is an executable program that, like perl, you use to run your script. It normally processes a file in the current dir call R

Re: syntax question conc​erning Rex::Commands​::Iptables perldoc s​ynopsis​

2012-08-17 Thread Andy Bach
On Fri, Aug 17, 2012 at 1:29 PM, Dominik Danter wrote: > Wow, that was fast; thank you! > I did define it - here is the code that produced the output: > #!/usr/bin/env perl > > use Rex::Commands::Iptables; Oh, well, that wasn't in the snippet. 'task' is actually in Rex, not Rex::Commands::Iptabl

Re: syntax question conc​erning Rex::Commands​::Iptables perldoc synopsis​

2012-08-17 Thread Brandon McCaig
Why are there U+200B characters in the subject? o_O On Fri, Aug 17, 2012 at 07:57:49PM +0200, Dominik Danter wrote: > Hi, > > I don't understand the following code: > > task "firewall", sub { >iptables_clear; >... >... > }; That is just a subroutine call. You

Re: syntax question conc​erning Rex::Commands​::Iptables perldoc s​ynopsis​

2012-08-17 Thread Dominik Danter
Andy Bach hat am 17. August 2012 um 20:25 geschrieben: > On Fri, Aug 17, 2012 at 1:19 PM, Andy Bach wrote: > > Well, 'task' isn't a Perl function built-in or core module > > Whoops - dang gmail hides the subject line on me - > http://search.cpan.org/~jfried/Rex-0.31.3/lib/Rex/Commands/Iptab

Re: syntax question conc​erning Rex::Commands​::Iptables perldoc s​ynopsis​

2012-08-17 Thread Andy Bach
On Fri, Aug 17, 2012 at 1:19 PM, Andy Bach wrote: > Well, 'task' isn't a Perl function built-in or core module Whoops - dang gmail hides the subject line on me - http://search.cpan.org/~jfried/Rex-0.31.3/lib/Rex/Commands/Iptables.pm you left off the line: use Rex::Commands::Iptables; The module

Re: syntax question conc​erning Rex::Commands​::Iptables perldoc s​ynopsis​

2012-08-17 Thread Andy Bach
On Fri, Aug 17, 2012 at 12:57 PM, Dominik Danter wrote: > String found where operator expected at ./test.pl line 5, near "task > "firewall"" Well, 'task' isn't a Perl function built-in or core module so ... can't find anything that uses that syntax for some kind of multitasking/fork/parallel (PO

syntax question conc​erning Rex::Commands​::Iptables perldoc s​ynopsis​

2012-08-17 Thread Dominik Danter
Hi, I don't understand the following code: task "firewall", sub { iptables_clear; ... ... }; I have searched for "perl task" and have not found anything meaningful. Copy pasting the snippet and executing result in the following: 1286 % ./test.pl String found whe

Re: array match- help !

2012-08-17 Thread Bill Stephenson
On Aug 17, 2012, at 10:07 AM, jet speed wrote: > Chaps, > > Thanks for all your comments, I am strill trying to resolve my inital > query. Any help would be much appreciated. > > > I have the below program. i can match the entries in actzone.txt file in > bluealias.txt and print it. > > what i

Re: array match- help !

2012-08-17 Thread jet speed
Chaps, Thanks for all your comments, I am strill trying to resolve my inital query. Any help would be much appreciated. I have the below program. i can match the entries in actzone.txt file in bluealias.txt and print it. what i would like to achive is to print the alias name and the reated wwn

Re: array match- help !

2012-08-17 Thread Shawn H Corey
On Fri, 17 Aug 2012 15:10:03 +0100 jet speed wrote: > > Your code is lacking indentation. Perhaps you should consider using Perl::Tidy to automatically format your code. http://search.cpan.org/~shancock/Perl-Tidy-20120714/lib/Perl/Tidy.pm -- Just my 0.0002 million dollars worth, Shawn

Re: array match- help !

2012-08-17 Thread Paul Anderson
Isn't this basically the format of YAML? Couldn't a YAML CPAN module handle this data? On 2012-08-17, at 10:10 AM, jet speed wrote: > Hi Shomi, > > Appreciate your comments.Thanks > > I find it difficult to understand, if i convert into has. i.e keys and > corresponding values. if my keys

Re: array match- help !

2012-08-17 Thread Shlomi Fish
Hi jet speed, I apologise for sending my reply to you in private instead of to the list. It was an accident. On Fri, 17 Aug 2012 15:10:03 +0100 jet speed wrote: > Hi Shomi, > It's "Shlomi". > Appreciate your comments.Thanks > You're welcome. > I find it difficult to understand, if i conv

Re: subroutine

2012-08-17 Thread Chris Stinemetz
> In the above line, `shift` will return just the first element from the > @_ array. $y will therefore be undefined. The line should be rewritten > as: > my ( $x, $y ) = @_; > Thank you. I should have caught that. Chris

Re: array match- help !

2012-08-17 Thread jet speed
Hi Shomi, Appreciate your comments.Thanks I find it difficult to understand, if i convert into has. i.e keys and corresponding values. if my keys are from @actzone and values are from @all. How can i do this, becuase there are 2 keys and values are multiple ex. alias: wwn: etc. how can i match

Re: subroutine

2012-08-17 Thread Alan Haggai Alavi
Hello Chris, > Can this subroutine be better written? > I am getting the following erros: > > Use of uninitialized value $y in subtraction (-) at form.pl line 52. > Use of uninitialized value $y in addition (+) at form.pl line 52. > > sub avg_az { > my($x, $y) = shift(@_); In the above line, `s

array match- help !

2012-08-17 Thread jet speed
Hi All, I have the below program. i can match the entries in actzone.txt file in bluealias.txt and print it. what i would like to achive is to print the alias name and the reated wwn for each zone that matched in 2 formats in different file ex. as below. Please could you help me achieve this. o

subroutine

2012-08-17 Thread Chris Stinemetz
Hello List, Can this subroutine be better written? I am getting the following erros: Use of uninitialized value $y in subtraction (-) at form.pl line 52. Use of uninitialized value $y in addition (+) at form.pl line 52. sub avg_az { my($x, $y) = shift(@_); return abs($x-$y)<180 ? ($x+$y)/2 :