GaijinPunch has asked for the wisdom of the Perl Monks concerning the following question:
gives me#!/usr/bin/perl # # use strict; use warnings; my $time = "123456.745768"; my $time2 = "123456.745768"; $time =~ s/^(\d{2})(\d{2})(\d{2})\.(\d{2})\d{4}/$1:$2:$3.$4/; $time2 =~ s/^(\d{2})(\d{2})(\d{2})\.(\d{2})/$1:$2:$3.$4/; print "$time\n"; print "$time2\n";
Shouldn't the substitution of $time2 work? IE -- see two digits after the '.' and then leave it at that?12:34:56.74 12:34:56.745768
but got the same (bad) results.$time2 =~ s/^(\d{2})(\d{2})(\d{2})\.(\d{2}).+?/$1:$2:$3.$4/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A would-be simple substitution...
by Roger (Parson) on Mar 02, 2004 at 07:33 UTC | |
|
Re: A would-be simple substitution...
by Tomte (Priest) on Mar 02, 2004 at 07:40 UTC | |
by GaijinPunch (Pilgrim) on Mar 02, 2004 at 08:53 UTC | |
|
Re: A would-be simple substitution...
by Aristotle (Chancellor) on Mar 02, 2004 at 10:24 UTC | |
|
Re: A would-be simple substitution...
by gmpassos (Priest) on Mar 02, 2004 at 20:28 UTC | |
|
Re: A would-be simple substitution...
by Anonymous Monk on Mar 03, 2004 at 08:28 UTC |