-----Original Message----- From: Chas. Owens [mailto:chas.ow...@gmail.com] Sent: Friday, May 29, 2009 10:22 AM To: sanket vaidya Cc: beginners@perl.org Subject: Re: Range Operator Question
On Thu, May 28, 2009 at 23:49, sanket vaidya <sanket.vai...@patni.com> wrote: snip > Can anyone write few simple codes explaining the behavior that Chas > mentioned, So that I can explore the codes for getting better picture? snip #!/usr/bin/perl >use strict; >use warnings; >use Data::Dumper; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> my @a = 1 ... 10; print "normal flip flop behavior:\n", "the .. operator\n"; for my $n (@a) { if ($n == 3 .. $n == 6) { print "\t$n\n"; } } print "\nthe ... operator\n"; for my $n (@a) { if ($n == 3 ... $n == 6) { print "\t$n\n"; } } print "\nbehavior when the condition is true for both tests at the same time\n", "the .. operator\n"; for my $n (@a) { if ($n == 3 .. $n == 3) { print "\t$n\n"; } } print "\nthe ... operator\n"; for my $n (@a) { if ($n == 3 ... $n == 3) { print "\t$n\n"; } } -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Got it & that's pretty interesting too. Thanks Chas Regards, Sanket Vaidya _____________________________________________________________________ This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at netad...@patni.com and delete this mail. _____________________________________________________________________ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/