Wildly off-topic perl discussion
stefankrah at bigfoot.com
Mon May 20 03:26:13 PDT 2002
* Rob 'Feztaa' Park <feztaa at shaw.ca> wrote:
> 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).
I throw in the following:
man perlfunc -> substr
A small demonstration:
perl -e '$DATESTRING = "20020510173501"; $year = substr($DATESTRING, 0, 4);
$month = substr($DATESTRING, 4, 2); print $year," ",$month,"\n"'
Of course, Perl stole that one from awk. :)
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