Wildly off-topic perl discussion

Rob 'Feztaa' Park feztaa at shaw.ca
Sun May 19 23:04:51 PDT 2002

I've got a 14-digit number (it's a date, YYYYMMDDHHMMSS), how do you
guys figure is the best way to split it up into separate variables? (I
want a variable for year, month, day, hour, minute, second).

As it stands now, I'm splitting up the string into an array (each digit
is an element in the array), and then concatenating each element into
the appropriate string. It's about 7 lines long, which is really too
many for something that should be fairly simple.

Some background info, if you care:

I'm writing a CGI script that interfaces with MySQL (It's just an
excercise in learning CGI/Apache stuff). The date is from a MySQL
timestamp column. Since this is inside an actual perl script, I need to
know how to do it in perl, even if there is some shell util that could
provide a more elegant solution.

Thanks, and have fun ;)

Rob 'Feztaa' Park
Speaking of purchasing a dog, never buy a watchdog that's on sale.
After all, everyone knows a bargain dog never bites!
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-chat' in the subject header of the message

More information about the lfs-chat mailing list