Hi all,
I have a case where by adding or removing a simple print statement, the results of my program change. My program is using OLE to set colors of certain text in Visio. Here is the code, I am using Perl 5.8.3
while ($text =~ /($pattern)/g) { my $startindex = $-[0]; my $endindex = $+[0]; my $capture = $1; print "$startindex $endindex\n"; ####REQUIRED OR WON'T WORK CO +RRECTLY! my $vsoChars = $VShape->Characters; $vsoChars->{Begin}=$startindex; $vsoChars->{End}=$endindex; $vsoChars->{Text}=$capture; $vsoChars->SetProperty('CharProps', 1, $color); }
I capture the start and end location of my found string into '$startindex' and '$endindex'. What I have found is that if I comment out the print statement, the {Begin} and {End} properties don't set correctly. With the print statement, everything works perfectly. Without it, it doesn't. I can't just print a carraige return or space or something else, I have to actually print the $startindex and $endindex values. I have verified that the data in $startindex and $endindex is the same (and correct) with and without the print statement. Has anyone ever seen anything like this?
Thanks in advance!
In reply to print statement changes results! by cr8josh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |