Hi Louis

>Louis Pouzin <[EMAIL PROTECTED]> wrote:
>I tried converting a series of similar formats:
>
>Is there a library module that recognizes this format ?

Don't get me wrong, modules can be very useful but I'm more of a 
Randal Schwartz kind of person (ie re -inventing the wheel yields 
other fruits besides the wheel). It's not that hard to write your own 
subroutine to parse this data, this kind of stuff is what makes Perl 
so useful.

The script below:

=SCRIPT=
#! perl -w

$d = "Wednesday, January 20, 1999 9:40:11 o'clock PM EST";

@temp = split (/,/,$d);

for (@temp){print $_,"\n";}

=OUTPUT=

Wednesday
  January 20
  1999 9:40:11 o'clock PM EST
=OUTPUT=

Gives you the data partially broken into it's components. A second 
pass on the array elements splitting on spaces will give you each 
data piece, which you can then do as you will like, for example check 
it against the keys of this  array-

%days= (Sunday => 0,
                   Monday=> 1,
                   Tuesday => 2,
                   Wednesday =>3,
                   Thursday => 4,
                   Friday => 5,
                   Saturday => 7
                   );

which will give you the value of the day in localtime() format.

check out the following for more info on parsing dates and times:
Shuck -> GO ->Perl FAQ->DATA MANIPULATION (aka perlfaq4.pod) search 
for "Data:dates"
Shuck -> GO ->BUILT IN FUNCTIONS (aka perlfunc.pod) search for "localtime"
and in the LIB folder  (in the MACPERL folder) have a look at Time::localtime


HTH

Robin

Reply via email to