Re: Dat files help "Att James"

From: Tad McClellan (tadmc_at_augustmail.com)
Date: 11/26/04


Date: Fri, 26 Nov 2004 16:34:59 -0600

hope@hope.com <hope@hope.com> wrote:
> On Fri, 26 Nov 2004 09:09:44 -0600, Tad McClellan <tadmc@augustmail.com>
> wrote:
>
>>
>>[ Please learn the proper way to compose a followup very soon.
>
>> You have the interleaving part down, that's good. Now add:
>>
>> 1) trim the quoted text to just enough to establish the context
>> for the comment that you are going to add.
>
> Ok now we are getting to different ideas again
> I have been told NOT to cut a post as other people who are going to read
> it cannot follow what the first post was all about and hence do not know
> what was going on.

If you do the "just enough" thingy I mentioned, then they *will*
know what is going on.

> So what should I do one person says one thing and another says something
> different

Lurk for a while and take note of how the frequent-answerers do it.

Then do it that way.

>> 2) limit your line lengths to the conventional 70-72 characters.
>> (you can probably set your newsreader to handle this for you)
>
> Yes you are correct , It was set to 180 characters. NOW set to 72 is
> that ok for you?

Lookin' good!

> Hmmm so you are saying that there is people who are in here would send
> you that type stuff

What does "send" mean there?

If you mean would they post malicious code here? Maybe, but probably
not. Someone will surely spot it (so be sure to follow threads that
you take code from to see if any followups find problems in the code).

If you mean email you malicious code, then you betcha that's what
I'm talking about.

> BTW that gets me confused some have a " in front and others have '
> like
> "c:/tom/fred"
> 'c:/tom/fred'
>
> I have done a search for this BUT not knowing what it is called came up
> with nothing.

See the "Quote and Quote-like Operators" section in:

   perldoc perlop

(you should read it (and several others) end-to-end as soon as possible.)

The short version of the difference is:

   Double quotes give you two things above and beyond what single
   quotes give you: backslash escapes and variable interpolation.

If you need one of those 2 things, use "double" quotes, if not
then use 'single' quotes.

> Fine now I have had a telling off and a lesson on all of this my
> original problem still is with me

You seem to display a good attitude, people are likely to keep
helping you until you "get it". Hang in there.

> The script does not work still.
             ^^^^^^^^^^^^^

Have you read the Posting Guidelines yet?

That is worthless information for us. It does not help us diagnose
the problem.

Tell us what you want it to do, and what it is doing instead.

> If you missed my first post that I asked and James sent me the script to
> do it here it is for you

> What I have is this
> 1....I have a load of dat files in a folder called users this is in the
> cgi folder like
> c:\apache\apache2\cgi-bin\data\users\1234.dat 5678.dat etc

   my @dat_files = glob 'c:/apache/apache2/cgi-bin/data/users/*.dat';

> 2.....Inside each of these dat files

   foreach my $fname ( @dat_files ) { # untested
      print "found '$fname'\n"; # for debugging
      open DAT, $fname or die "could not open '$fname' $!";
      while ( <DAT> ) {
         # do something with the line in the $_ variable
      }
      close DAT;
   }

> I have information like
                     ^^^^

We do not have enough information about the details of your data
to help you with actual code. You should have posted some sample data.

> 3.....Now what I want to do is fetch the above info out of the dat files
> and do one of two things

> 2......Make a text/csv file

> If you could give me some pointers on how to do this OR point me in the
> right direction to where I could get some examples please

The very first stop whenever you find your self wanting to
do "whatever" is to see if there is a module that already
does that "whatever".

If you can find one, you get all of that coding for free!

   http://search.cpan.org/search?query=CSV

-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas