CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
How to substruct HH:MM:SS:MS

 



tester_V
Novice

Jan 9, 2018, 8:47 PM

Post #1 of 2 (2092 views)
How to substruct HH:MM:SS:MS Can't Post

Greetings!
I need help substructing time HH:MM::SS::MS
I have heared Time::piece might help but I confused how to use it.
Here is the code I got so far:

Code
#!/usr/local/bin/perl 
use strict ;
use warnings ;
use diagnostics ;
use Time::Piece;

my $cleanfile = 'SomeFile.txt' ;


open my $cleanfile_fh,'<',$cleanfile or die "Cannot open file !& \n" ;

while (my $ln = <$cleanfile_fh>)
{
chomp $ln ;
{

my ($fst1,$sec2) = split/,/, $ln ;

Data example:

01:21:48.955,01:21:48.953
01:22:51.717,01:22:51.695
01:23:50.533,01:23:50.532
01:24:49.809,01:24:49.808
01:26:29.369,01:25:52.421
01:27:28.696,01:27:28.695
01:29:03.565,01:28:30.367
Thank you!
Tester V


Laurent_R
Veteran / Moderator

Jan 9, 2018, 11:20 PM

Post #2 of 2 (2089 views)
Re: [tester_V] How to substruct HH:MM:SS:MS [In reply to] Can't Post

First off, this:

Quote
die "Cannot open file !& \n" ;

is probably wrong. I guess that you want this:

Quote
die "Cannot open file $! \n" ;

to get some information about the problem if the program fails to open the file.

Also, your code is incomplete (two opening braces, without any closing brace) and it will not compile as is.

Otherwise, there is no question in your post and you're not saying what you want to obtain from the input data, so it is a bit difficult to provide any guidance.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives