Re: Question on Unless and Until

2010-08-29 Thread Uri Guttman
> "JG" == Jim Gibson writes: JG> The unless construct above is correct. The 'until' construct is JG> not. 'until' can only occur at the end of a block preceded by 'do' or JG> at the end of a statement as a modifier. JG> do { JG> ... JG> } until( condition ); until is just

Re: Question on Unless and Until

2010-08-29 Thread Jatin Davey
Thanks Jim I got the understanding from this sample code as well: #!/usr/bin/perl use warnings; use strict; print "Enter your age : "; unless ((my $age = ) < 18) { print "you can vote \n"; } Thanks Jatin On 8/30/2010 11:15 AM, Jim Gibson wrote: At 9:53 AM +0530 8/30/10, Jatin Davey wrote:

Re: How to test Output when using IPC::Open3

2010-08-29 Thread marcos rebelo
We are out of contest in here. I know how to run open3, but I don't know how to test it. Repeating use strict; use warnings; use IPC::Open3; use IO::Handle; use Test::More; use Test::Trap; sub shell_run { my ($stdin, $stdout, $stderr) = map {IO::Handle->new} (0..2); print ""; open

Re: Question on Unless and Until

2010-08-29 Thread Jim Gibson
At 9:53 AM +0530 8/30/10, Jatin Davey wrote: Hi All I a newbie to perl. Reading through some of its basics on if constructs , while constructs and so i also found a the unless and until constructs. let me take the if construct , basically it is like this : if () { .} now in the above

Re: How to test Output when using IPC::Open3

2010-08-29 Thread C.DeRykus
On Aug 28, 10:42 pm, ole...@gmail.com (marcos rebelo) wrote: > the idea is to process the STDOUT ad the STDERR. > > open don't do it > I was afraid you'd say that... open3 is very liable to deadlock since you're trying to read from both stderr and stdout. You'll very likely want to use IO::Selec

Question on Unless and Until

2010-08-29 Thread Jatin Davey
Hi All I a newbie to perl. Reading through some of its basics on if constructs , while constructs and so i also found a the unless and until constructs. let me take the if construct , basically it is like this : if () { .} now in the above construct if the condition evaluates to *true*

Re: chomp () function

2010-08-29 Thread Jim Gibson
At 8:17 PM +0530 8/29/10, Kaushal Shriyan wrote: I am referring to http://www.perl.org/books/beginning-perl/. so I am planning to read upto chapter 10. is it recommended to even go beyond chapter 10. Please suggest. I have not read that online resource, but looking at the contents I would re

Re: chomp () function

2010-08-29 Thread Kaushal Shriyan
On Sun, Aug 29, 2010 at 7:58 PM, Chas. Owens wrote: > On Sun, Aug 29, 2010 at 09:41, Kaushal Shriyan > wrote: > snip >> Thanks a lot Chas. Understood now. >> Also what does $_ default variable means exactly, any example would >> really help me understand it > snip > > The default variable is set

Re: chomp () function

2010-08-29 Thread Chas. Owens
On Sun, Aug 29, 2010 at 09:41, Kaushal Shriyan wrote: snip > Thanks a lot Chas. Understood now. > Also what does $_ default variable means exactly, any example would > really help me understand it snip The default variable is set or read by many Perl 5 functions. For instance, if you use the rea

Re: chomp () function

2010-08-29 Thread Kaushal Shriyan
On Sun, Aug 29, 2010 at 7:06 PM, Chas. Owens wrote: > On Sun, Aug 29, 2010 at 09:23, Kaushal Shriyan > wrote: >> On Sun, Aug 29, 2010 at 6:11 PM, Chas. Owens wrote: >>> On Sun, Aug 29, 2010 at 07:15, Kaushal Shriyan >>> wrote: Hi Can someone please explain me with an example of

Re: chomp () function

2010-08-29 Thread Chas. Owens
On Sun, Aug 29, 2010 at 09:23, Kaushal Shriyan wrote: > On Sun, Aug 29, 2010 at 6:11 PM, Chas. Owens wrote: >> On Sun, Aug 29, 2010 at 07:15, Kaushal Shriyan >> wrote: >>> Hi >>> >>> Can someone please explain me with an example of the usage chomp () >>> builtin function in perl. >> snip >> >>

Re: chomp () function

2010-08-29 Thread Kaushal Shriyan
On Sun, Aug 29, 2010 at 6:11 PM, Chas. Owens wrote: > On Sun, Aug 29, 2010 at 07:15, Kaushal Shriyan > wrote: >> Hi >> >> Can someone please explain me with an example of the usage chomp () >> builtin function in perl. > snip > > The chomp function removes whatever is in the $/ variable from the

Re: chomp () function

2010-08-29 Thread Chas. Owens
On Sun, Aug 29, 2010 at 07:15, Kaushal Shriyan wrote: > Hi > > Can someone please explain me with an example of the usage chomp () > builtin function in perl. snip The chomp function removes whatever is in the $/ variable from the argument passed in (or $_ if no argument is passed in). The defau

Re: chomp () function

2010-08-29 Thread Shlomi Fish
On Sunday 29 August 2010 14:15:52 Kaushal Shriyan wrote: > Hi > > Can someone please explain me with an example of the usage chomp () > builtin function in perl. Yes, here you go. Let's suppose you want to write a small grep programs that only prints all lines ending with the character "\". You

chomp () function

2010-08-29 Thread Kaushal Shriyan
Hi Can someone please explain me with an example of the usage chomp () builtin function in perl. Thanks Kaushal -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/