I'm having some trouble getting it to work.
Will you look at my code and see what could be wrong?

$cs="d:\\Perl\\Compiler_Setup.ini"; open cs or die "Cannot open $cs for read :$!"; while (<cs>) { if (m/"Gimpel PC-Lint for H8]"/){ # read the line to be replaced my $line = <cs>; # do something with it $line =~ s/1/0/; # print the new version print $line; } }

Right now it just doesn't do anything.
in a command prompt I write
perl "replace test.pl"
and then it just goes back to d:\perl> as if it ran the program, and then just goes back to where I was before. It says:

D:\Perl>perl "replace test.pl"

D:\Perl>

In reply to Re^3: Search and replace next line by perlnewbie2000
in thread Search and replace next line by perlnewbie2000

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.