Hello. I have a logfile in which every message begins with a timestamp (ex. - 
20012091500). I would like to be able to remove the last 4 characters (1500) off each 
of these to derive the date only (2001209). It works by chopping of each character 
individually, but I would like to know if there is a cleaner way to do this via regex 
or possibly by chopping multiple characters off at once.

$ts = "200212091500";
chop ($ts);
chop ($ts);
chop ($ts);
chop ($ts);

print "$ts\n";


Thanks,
Jose

Reply via email to