I am using ActivePerl on a windows 2000 machine. My script reads all the files in a directory, does some reformating and plops them all into one big file in another directory. My script wrks if I have the .pl in the same dirctory as the files and use the ".". But, If i use a path to the directory it does not work. Any thoughts. thanks for any info, Bernie
#!/usr/bin/perl #Parses web log and reformats opendir(DIR, 'c:\perl\test'); ##If . is used and .pl is in the same d +ir as files it works! @files = readdir(DIR); close(DIR); foreach $file (@files) { $name = $file; @filename = split (/\./, $name); # open (MYFILE, ">myfile.txt"); open( THEFILE,$file ) ; @theList = <THEFILE>; close( THEFILE ); foreach( @theList ) { s/\/uid=/,/; s/LDAP:\/\///; s/ou=//g; s/o=//; @theLine = split( /\s*,\s*/ ); print "\"$theLine[0]\",\"$theL +ine[1]\",$theLine[2]\",\"$theLine[3]\",\"$theLine[4]\",\"$theLine[5]\ +",\"$theLine[6],\"$filename[0]\",\"$filename[1]\",$theLine[7] \n"; } } exit( 0 );

In reply to Directory Stuff by Anonymous Monk

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.