Help for this page

Select Code to Download


  1. or download this
    #!/volume/perl/bin/perl
    use warnings;
    ...
    my @output_list = $time =~ /(\d+)/g;
    
    print "@output_list\n";  # 01 00 01 004
    
  2. or download this
    #!/volume/perl/bin/perl
    use warnings;
    ...
    seconds=01
    milliseconds=004
    
  3. or download this
    my $time = "01:00:01.004";
    
    my ($no_ms) = $time =~ /([\d:]+)/; #any digit or colon
    
    print "no milliseconds = $no_ms\n"; no milliseconds = 01:00:01
    
  4. or download this
    my $time = "01:00:01.004";
    $time =~ s/\.\d+$//; #explictly delete the ending milli_seconds
    print "time stripped ms = $time\n";
    #time stripped ms = 01:00:01