in reply to Re: Command Line
in thread Command Line

Great, thanks! Just one thing - I want the third input - STRING , to be the word that I look for and not replace with. If I don't put anything there I want the code to work as it is, and if I do I need it to look for STRING instead of looking for QUALIFIED_CLOCK...

Replies are listed 'Best First'.
Re^3: Command Line
by guyov1 (Novice) on Oct 22, 2008 at 13:06 UTC
    I was trying to replace the line mentioned with
    next if ( $find_flag and ( if ($replacement == "") { /\s+QUALIFIED_C +LOCK/ } else { /\s+$replacement/ } ));
    But it writes me "syntax error". I cant understand why... What I'm trying to do is check whether I entered a string and then look for it, and If not, look for QUALIFIED_CLOCK .
      like that?
      my ($iFile, $oFile, $searchFor) = @ARGV; $searchFor = quotemeta( $searchFor || 'QUALIFIED_CLOCK ); .... next if $find_flag and /\s+$searchFor/;


      holli, /regexed monk/
        The problem is that if I put a STRING, it will still delete me lines with QUALIFIED_CLOCK and not just lines containing STRING. I need it to do the following: If no STRING is inputted, skip lines with QUALIFIED_CLOCK, if is, keep lines with QUALI but skip lines with STRING.
      Hint: Try counting your open and close parens, per block.
        I'm counting and it still looks alright. 3 "(" 3 ")" , 2 "{" and 2 "}" .