Within the function, you're modifying variables not declared within the function—is it possible you're clobbering variables declared elsewhere? In specific, the use of $record looks suspicious. What happens if you say:
sub fn1 { my ($fh, $ucsearch) = @_; my $count = 0; while (my $record = <$fh>) { next unless uc($record) =~ /$ucsearch/; print $record; $count++; } return $count; }
You'll have to change how you call the function (and you'll have to use its return value), but the lexical encapsulation may help avoid weird action at a distance.
If that doesn't help, you'll have to show more code.
Improve your skills with Modern Perl: the free book.
In reply to Re: losing html in print calling function.
by chromatic
in thread losing html in print calling function.
by Librum
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |