I need to go through a large amount of perl files to change certain paths and urls contained in them. Unfortunately, i'm not at my home computer, so i don't have the script available right now, but will try to post it soon.

Basically, i have the readdir command and capture all the perl files in the directory. I then open up each file (using a foreach loop with the filenames being looped and going into an open command. Then i go through every line in the opened file, searching for a specific path or url template and replacing it with the new one. Then, before going on to the next file, it writes the now edited lines into the file. When i tried this, it merely created a blank copy of every perl file with .txt at the end.

I haven't had much time to play with it, but i was wondering if there is a better, more efficient way of going through all the perl files and replacing a certain part in a line...also, don't crucify me for not having the script, i would have posted it, but i've been grounded (don't laugh) and can't use my home computer for a while. Anyway, thanks for any help you may be able to give me...

Just Another Perl Wannabe

In reply to Changing lots of files... by arrow

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.