On Tue, Nov 01, 2011 at 05:41:27PM +0100, John Delacour wrote:

> Yes, just use a switch:
> 
> #! /usr/bin/perl
> use strict;
> my $switch_on;
> while (<>) {
>   $switch_on = 1 if /<caption>/;
>   $switch_on = 0 if s/td>/th>/g;
>   print;
> }
> __END__

What is the purpose of $switch_on here?  You set it, but you never do
anything with its value, so you might as well just do this:

#!/usr/bin/perl
use strict;
while (<>) {
  s/td>/th>/g;
  print;
}
__END__

Ronald

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to