On Thu, May 28, 2009 at 23:49, sanket vaidya <[email protected]> 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.
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/