in reply to losing html in print calling function.
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: losing html in print calling function.
by LesleyB (Friar) on Nov 21, 2011 at 16:17 UTC | |
by Librum (Initiate) on Nov 21, 2011 at 16:29 UTC | |
|
Re^2: losing html in print calling function.
by Librum (Initiate) on Nov 21, 2011 at 16:17 UTC |