if ($left .. $right)
{
...
}
####
while ()
{
print if 2 .. 4;
}
__DATA__
first
second
third
fourth
fifth
__OUTPUT__
second
third
fourth
##
##
while ()
{
print if /start/ .. /end/;
}
__DATA__
ignore
start
first
second
third
end
ignore
start
fourth
fifth
end
ignore
__OUTPUT__
start
first
second
third
end
start
fourth
fifth
end
##
##
while ()
{
print if 2 .. /end/;
}
__DATA__
first
second
third
end
ignore
__OUTPUT__
second
third
end
##
##
while ()
{
if (my $num = /start/ .. /end/)
{
print unless $num == 1 || $num =~ /E/;
}
}
__DATA__
ignore
start
first
second
third
end
ignore
start
fourth
fifth
end
ignore
__OUTPUT__
first
second
third
fourth
fifth
##
##
while ()
{
if (my $num = /start/ .. /end/)
{
print $num, "\t", $_;
}
}
__DATA__
ignore
start
first
second
third
end
ignore
start
fourth
fifth
end
ignore
__OUTPUT__
1 start
2 first
3 second
4 third
5E0 end
1 start
2 fourth
3 fifth
4E0 end
##
##
while ()
{
if (my $num = /start/ .. /end/)
{
print $num, "\t", $_;
}
}
__DATA__
ignore
start
first
second
end
ignore
start third end
ignore
__OUTPUT__
1 start
2 first
3 second
4E0 end
1E0 start third end
##
##
while ()
{
if (my $num = /start/ ... /end/)
{
print "$num\t$_";
}
}
__DATA__
ignore
start first end
ignore
__OUTPUT__
1 start first end
2 ignore