reading contents of file writing data to another

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jDawg123
    New Member
    • May 2007
    • 1

    reading contents of file writing data to another

    Can somone plz give me some ideas on writing a perl script that reads the contents of files from a directory and outputs to an output file the areas in the files read from the directory that have two or more blank spaces between words. Leading and trailing white spaces between sentences shout not be considered.
    Thanks
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    use the open() function to open the files for reading and writing. Use a regexp to find the pattern you are looking for to write to the new file.

    Comment

    • savanm
      New Member
      • Oct 2006
      • 85

      #3
      Hi,


      $path=$ARGV[0];##Getting the path from the First Argumnt
      $path=~s/\\/\//sg;
      opendir(DIR,$pa th) || die("cannot open the file");
      @files = grep(/\.*/,readdir(DIR));
      closedir(DIR);
      Then Use The regular Expressions According to ur need
      Finally Write the file using the symbol '>'

      Navas.M

      Comment

      Working...