SPUG: range operator
Florentin
florentin_ at hotmail.com
Thu Mar 29 00:26:44 PDT 2007
Please help me understand how range operator works :
# cat _a
# x1
# a
# x5
# x1
# b
# x3
# c
# d
##-------------
my $start=qr/x1/;
my $end=qr/x3|x5/;
# prints all aa minus c, d - OK
while( <>) { if(/$start/../$end/){ print ; } }
# Expect to print only a and b --> it prints all from x1 to x3 as above
while( <>) {
if(/$start/+1 ../$end/-1) {
print ;
}
}
# Expect to print only a and b --> prints nothing ??
while( my $x = <>) {
if($x=~m/$start/+1 .. $x=~m/$end/-1){
print ;
}
}
Thank you.
More information about the spug-list
mailing list