22925Re: [PBML] Re: Time string parsing
- Mar 1, 2006On Mar 1, 2006, at 4:13 AM — 3/1/06, acummingsus wrote:
> On Tuesday 28 February 2006 10:49, Shawn Hirn wrote:Thanks. For some reason, when I leave off the third argument, I get
> > I am working with the Time::Interval CPAN module's getInterval
> feature and
> [ . . ]
> > What I want is a variable called $y that's just the total seconds
> > represented by $x.
> > For example, if ...
> > $x = 1 hours, 2 minutes, 30 seconds" I want
> > $y = 3750
> > So, how can I get to $y from $x? I have been reading the Perl
> cookbook and
> if you want to use the same module in order to get your desired $y
> $number_of_seconds = convertInterval(
> hours => 1,
> minutes => 2,
> seconds => 30,
> ConvertTo => "seconds"
> # ------------------
> yes, at that above url, its doc says that convertinterval will do
> Now, whether or not scalar variable can be used instead of the
> (example: the explicit 2 for minutes), I don't know. Also you will
> need to
> parse $x in order to get each of the 3 numbers.
> Maybe there's another way, easier. But if scalar variable can be
> used, as I mentioned, then it could be done in this way.
as a result. I also get the same thing if I use "0" as the third
Sorry, I should have indicated that information in my original posting.
Does anyone see what I am doing wrong, or is this CPAN module buggy?
- << Previous post in topic Next post in topic >>