On Monday 12 July 2004 01:47, Paul Smith wrote: > > Thanks, Gunnar. I understand your point of view. Meanwhile, John > Krahn has kindly provided a solution for my problem, which I very > much thank. However, to convince you that I was trying to solve the > problem by myself, I quote below the script that I have written and > that also solves the problem: > > #!/usr/bin/perl > use warnings; > use strict; > > $a = 0; > > ( $^I, @ARGV ) = ( '.bak', '/home/paul/.reminders' ); > while ( <> ) { > if ($a == 1) { > s/^#//; > print; > $a = 0; > } > elsif (/Zyloric/) { > s/^#//; > print; > $a = 1; > } > else { > print; > } > }
Sorry, I like to tweek code. You could shorten that a bit: #!/usr/bin/perl use warnings; use strict; ( $^I, @ARGV ) = ( '.bak', '/home/paul/.reminders' ); while ( <> ) { if ( $a or /Zyloric/ ) { s/^#//; $a = !$a; } print; } __END__ :-) John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>