On Jun 6, Kevin Old said: >What I need is for a script (when run) to open a specified file and >comment out a certain line of code. This script will be run via a cron >job late at night.
Why use a regex for this? If you're checking for STRING EQUALITY, you should use the 'eq' operator. while ($line = <FILE>) { chomp; # remove newline if ($line eq '${tmp} = "Enable" if( ${zone} =~ /gvl/i ) ;') { $line = "#$line"; } print OUTPUT "$line\n"; } >$string =~ s/(\$\{tmp\} \= \"Enable\" if\( \$\{zone\} \=~ \/gvl\/i \) \;)/#$1/; The {, }, =, ", and ; do not need backslashes. And, if you use something other than / for the s/// delimiter, the /'s won't need backslashes either. $string =~ s[(\${tmp} = "Enable" if\( \${zone} =~ /gvl/i \) ;)][#$1]; That looks to me like it should work, but again -- no need for a regex, since you're testing for equivalency, not pattern matching. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]