Click here to get back home

Re: Time and again

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Re: Time and again Peter J. Holzer 06-10-2008
Posted by Peter J. Holzer on June 10, 2008, 4:49 pm
Please log in for more thread options
>>print scalar localtime();
>>gives
>>Tue Jun 10 11:28:55 2008
>>
>>I write that to a file and later I read it in
>
> Why are you dumping the data into a file and then reading it back in?

That's what files are for. Why would you write something into a file if
you didn't plan to read it at some time?

        hp

Posted by Jürgen Exner on June 10, 2008, 5:22 pm
Please log in for more thread options
>>>I write that to a file and later I read it in
>>
>> Why are you dumping the data into a file and then reading it back in?
>
>That's what files are for. Why would you write something into a file if
>you didn't plan to read it at some time?

Well, why would you write something to a file and then read it back into
the program if you already have the information in the program to begin
with?

It all depends on what the OP meant with "later". I have seen code like
        
        system ("myprog > temp.txt");
        open (TMP, '<', 'temp.txt');
        @result = <TMP>;

Here the programmer writes information to a file and later reads it back
into the program, but unless there are very special circumstances
probably nobody would call this good code.

The OP already clarified that this is not what he was doing but that he
was dealing with log files. But that detail was missing in the original
post.

jue

Posted by Ben Morrow on June 10, 2008, 5:53 pm
Please log in for more thread options

>
> It all depends on what the OP meant with "later". I have seen code like
>         
>         system ("myprog > temp.txt");
>         open (TMP, '<', 'temp.txt');
>         @result = <TMP>;

I've done this in the past. It was the only way I could find at the time
to get the output of an external process under Win98...

> Here the programmer writes information to a file and later reads it back
> into the program, but unless there are very special circumstances
> probably nobody would call this good code.

...I guess those probably count as 'very special circumstances' :).

Ben

--
I touch the fire and it freezes me, [ben@morrow.me.uk]
I look into it and it's black.
Why can't I feel? My skin should crack and peel---
I want the fire back... BtVS, 'Once More With Feeling'

Posted by Jürgen Exner on June 14, 2008, 8:09 am
Please log in for more thread options
[Whatever]

Clearly your ESP::PSI module is far supperior to mine. That's OK, I
don't mind.
But I don't how see how continuing this discussion would serve any
useful purpose. But again, maybe my crystal ball has failed me.

jue

Similar ThreadsPosted
GMT time to local time, according to timezone and summer/winter time. May 15, 2005, 10:45 pm
Calculating time of employee session from the log date/time stampusing perl May 24, 2005, 5:55 pm
How do I convert TIME into Cookie and last-modified-time format? October 1, 2004, 3:05 pm
Compare UNIX file time with time in a variable November 23, 2006, 2:39 pm
How to send a query to the browser from time to time? July 20, 2005, 9:35 am
Time::Format with two $time strings February 23, 2005, 4:56 pm
Perl time and Mysql time September 26, 2005, 7:47 pm
Probelm to post XML data in a loop. First time XML is posted, second time data is getting truncated. Please help. February 9, 2006, 7:01 am
Why '' Is Matched First Time, Not Second Time August 21, 2004, 1:34 am
how to set time February 18, 2005, 5:42 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap