Re: How does grep command compare a hash element with an array of hash references?

2010-09-24 Thread Erez Schatz
On 09/25/2010 01:57 AM, Vaishnavi Saba wrote: > @common = inter( \%foo, \%bar, \%joe ); > sub inter { > my %seen; > for my $href (@_) { > while (my $k = each %$href ) { > $seen{$k}++; > } > } > return grep { $seen{$_} == @_ } keys %seen; > } Usually not a go

Re: How does grep command compare a hash element with an array of hash references?

2010-09-24 Thread John W. Krahn
Vaishnavi Saba wrote: Hi, Hello, My query: In the code shown below, How does *grep* compare a scalar( * $seen{$_}* ) with an array of hash references ( *...@_* ). An array in scalar context returns the number of elements in the array and @_ (which is an alias to @common) contains 3 element

How does grep command compare a hash element with an array of hash references?

2010-09-24 Thread Vaishnavi Saba
Hi, My query: In the code shown below, How does *grep* compare a scalar( * $seen{$_}* ) with an array of hash references ( *...@_* ). = @common = inter( \%foo, \%bar, \%joe ); sub inter { my %seen; for my $href (@_) { while (my $k = each %$href ) { $seen{$k}++;

Re: Good Perl Books

2010-09-24 Thread Brian Fraser
> On Fri, Sep 24, 2010 at 2:30 PM, Francisco Valladolid wrote: > Hi. > > I think any perl book can be good! > I'm suddenly reminded of this slide: http://mag-sol.com/talks/idiotic/text9.html As a beginner myself, I was lucky enough to start with Learning Perl, 5th edition, of which I have absolut

Re: Returing exit status in perl

2010-09-24 Thread C.DeRykus
On Sep 23, 9:42 am, soorajspadmanab...@gmail.com (Sooraj S) wrote: > Hi, > > In my perl script p1 i am calling another script p2 which logs into a > remote machine and executes a script p3. The $file defined in p3 does > not exist. So copy operation in p3 will error out with error code 256 > and p3

Re: Returing exit status in perl

2010-09-24 Thread Shlomi Fish
Hi Sooraj, On Friday 24 September 2010 13:54:06 Sooraj S wrote: > Hi Shlomi, > > > Did you try looking at the shell's "$?" variable? > > I've clearly mentioned that i am using the "$?" value to find out the > exist status through out my code. Well, you need to add a command like: echo $? At t

Re: Good Perl Books

2010-09-24 Thread Uri Guttman
> "FV" == Francisco Valladolid writes: FV> I think any perl book can be good!, The list is complete here. please don't say that. there have been hundreds of perl books published over the years and my estimate is only about 30% are decent or better than that. too many were poorly written, e

Re: Good Perl Books

2010-09-24 Thread Francisco Valladolid
Hi. I think any perl book can be good!, The list is complete here. Personally I used: Learning Perl 2ed, From Randal Schwartz, and Elements of programming with perl (Manning) Whenever the http://perldoc.perl.org contain good documentation Regards. On Fri, Sep 24, 2010 at 10:53 AM, Parag Kalra

Re: Good Perl Books

2010-09-24 Thread Parag Kalra
>>>Learning Perl >>>by Randal L. Schwartz, Tom Phoenix, and brian d foy >>>ISBN 0-596-52010-7 [5th edition June 2008] >>>http://oreilly.com/catalog/9780596520106/ Must must must read book for any beginner. Cheers, Parag On Fri, Sep 2

Re: Returing exit status in perl

2010-09-24 Thread Sooraj S
Hi Shlomi, > Did you try looking at the shell's "$?" variable? I've clearly mentioned that i am using the "$?" value to find out the exist status through out my code. >What do you mean by not exist? In p3 u can see that my $file = "/hom/user/file"; I've given the location wrongly as a part of e

Re: Need Regex for phone number

2010-09-24 Thread Randal L. Schwartz
> "lotug" == lotug writes: lotug> I need regex code to identify 3108222400 phone number. This question was posted (with the same vagueness) to comp.lang.perl.misc. Check out some of the answers there. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 http

Re: automatic searching

2010-09-24 Thread Jeff Pang
> In my file, each line has : ID (8 number) | many key words |key words again > . > I would like to know how to extact only key words part and automatic > searching in website like google. for extracting: use split or regex. for googling: google has provided the SOAP API for programming. There is

Re: Good Perl Books

2010-09-24 Thread Jeff Pang
from PerlFAQ: Recommended books on (or mostly on) Perl follow. References Programming Perl by Larry Wall, Tom Christiansen, and Jon Orwant ISBN 0-596-00027-8 [3rd edition July 2000] http://www.oreilly.com/catalog/pperl3/

Re: Returing exit status in perl

2010-09-24 Thread Shlomi Fish
Hi Sooraj, On Thursday 23 September 2010 18:42:17 Sooraj S wrote: > Hi, > > In my perl script p1 i am calling another script p2 which logs into a > remote machine and executes a script p3. Generally speaking, executing one perl script you've written from another perl script is an indication th

Re: Good Perl Books

2010-09-24 Thread Jatin Davey
I've been collecting a list of books and many other resources on the Perl Beginners' Site: http://perl-begin.org/ Especially of note are: 1. http://perl-begin.org/books/advanced/#pbp - Perl Best Practices by Damian Conway. 2. http://github.com/chromatic/modern_perl_book - chromatic's "Modern

Good Perl Books

2010-09-24 Thread Shlomi Fish
Hi Jatin, first of all don't start a new thread by replying to an existing message. Instead, send a new message (with a new Subject line) to beginners@perl.org . On Friday 24 September 2010 12:18:52 Jatin Davey wrote: > Hi > > I just learned the basics of the perl programming language. I woul

automatic searching

2010-09-24 Thread xuanshi liu
Dear everyone, In my file, each line has : ID (8 number) | many key words |key words again . I would like to know how to extact only key words part and automatic searching in website like google. At the end , ID with the search results (can be links, terms) which use the key words in this ID still

Re: Web UI Automation

2010-09-24 Thread Jatin Davey
Hi I just learned the basics of the perl programming language. I would like to know if there are good books that can help me in further learning and achieving expertise in Web automation using perl. Appreciate your response in this regard. Thanks Jatin On 9/23/2010 9:10 PM, Jatin wrote: H

Re: Need Regex for phone number

2010-09-24 Thread Yogesh Sawant
On Fri, Sep 24, 2010 at 12:50 AM, lotug wrote: > I need regex code to identify 3108222400 phone number. > > If all of your phone numbers are ten digit, then: die "$phone_num is not a ten digit number" unless ($phone_num =~ m/^\d{10}$/); Do you need to include any more criteria? Regards, Yogesh

Re: Need Regex for phone number

2010-09-24 Thread Goke Aruna
Ernest, Can you be a bit more detail into what you have and what you want? Thank On 9/23/10, lotug wrote: > I need regex code to identify 3108222400 phone number. > > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http

Need Regex for phone number

2010-09-24 Thread lotug
I need regex code to identify 3108222400 phone number. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Returing exit status in perl

2010-09-24 Thread Sooraj S
Hi, In my perl script p1 i am calling another script p2 which logs into a remote machine and executes a script p3. The $file defined in p3 does not exist. So copy operation in p3 will error out with error code 256 and p3 stops execution with exit staus 256. But p2 is not able to recieve this value