From: Stan R. on
Abigail wrote:
[...]
> My advice is to *never* use /o. There's no point in using it for
> speed, and when it matters for speed, the effect may not be what you
> want - and even if you want it, it may confuse anyone else looking at
> the code.
>
> for (qw /foo bar/) {
> print /$_/ ? "Yes 1\n" : "No 1\n";
> print /$_/o ? "Yes 2\n" : "No 2\n";
> }
> __END__
> Yes 1
> Yes 2
> Yes 1
> No 1

I get "No 2" on the end, not "No 1"

$ perl -e 'for (qw /foo bar/) {
print /$_/ ? "Yes 1\n" : "No 1\n";
print /$_/o ? "Yes 2\n" : "No 2\n";
}'
Yes 1
Yes 2
Yes 1
No 2

I guess you didn't actually run the code you posted, or you typed from
memory :-P

--
Stan


From: Abigail on
Stan R. (stan.remove(a)bremove.lz.hmrprint.com) wrote on MMMMCDXLVIII
September MCMXCIII in <URL:news:1131128551_1603(a)spool6-east.superfeed.net>:
"" Abigail wrote:
"" [...]
"" > My advice is to *never* use /o. There's no point in using it for
"" > speed, and when it matters for speed, the effect may not be what you
"" > want - and even if you want it, it may confuse anyone else looking at
"" > the code.
"" >
"" > for (qw /foo bar/) {
"" > print /$_/ ? "Yes 1\n" : "No 1\n";
"" > print /$_/o ? "Yes 2\n" : "No 2\n";
"" > }
"" > __END__
"" > Yes 1
"" > Yes 2
"" > Yes 1
"" > No 1
""
"" I get "No 2" on the end, not "No 1"

Indeed.

""
"" $ perl -e 'for (qw /foo bar/) {
"" print /$_/ ? "Yes 1\n" : "No 1\n";
"" print /$_/o ? "Yes 2\n" : "No 2\n";
"" }'
"" Yes 1
"" Yes 2
"" Yes 1
"" No 2
""
"" I guess you didn't actually run the code you posted, or you typed from
"" memory :-P

Oh, I ran it. Then copied into my posting. Then modified it, and typed the
last line by hand instead of using the mouse.


Abigail
--
perl -wle'print"?????????????????????"^"\x80"x24'