UPDATE::: I found that if I include a '\n' character to the print line, the matches are printed to screen. For some strange reason it will not print to screen without it.( or without the extra print line as pointed out in the original post below. ___________ P.S. I only have one of the blocks active in the code at a time, not both.
Why? Hello, I,m using perl 5.1 This first one finds the matches of ABC######## this one fails to print ####### if($templine =~ /(ABC)/) {print " xxx xx";} ######## when this one works ###### if($templine =~ /(ABC)/) {print " xxx \n xx";}
?????????????????????????????????????????????????????? # This first one finds the matches of ABC ?????????????????????????????????????????????????????? foreach my $line (@_lines) { my $templine= $line; print "$templine"; # or print "$line"; if($templine =~ /(ABC)/){print "$1 = the line";} } #?????????????????????????????????????????????????????? # This next one doesn't find the matches of ABC #?????????????????????????????????????????????????????? foreach my $line (@_lines) { my $templine= $line; ############ print "$templine"; ############ # or print "$line"; if($templine =~ /(ABC)/){print "$1 = the line";} }
If printed to LOG, (e.g. print LOG $templine;), it fails as if I didn't print it at all. Why is the printing of the variable, or the variable it was just set equal to, making a difference. Thank You! Brian
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |