[reply cross-posted to list]
Olav Rogall wrote:
>
> Hallo fliptop,
>
> Am Tuesday, November 27, 2001 um 12:39:38 AM schriebst Du:
>
> >> $total_time = get_minutes('abc.mp3') + ':' + get_seconds('abc.mp3');
> >>
> >> the result in $total_time is "3:1", but it should be "03:01".
> >>
> >> how can i fill up the strings with a leading zero if the returned
> >> value is only one char?
>
> f> perldoc -f sprintf
>
> sprintf works for output, but i wan't it in the string $total_time.
> this string is part of a value for a mysql-database.
printf is for output.
my $minute = 1;
my $adj_minute = sprintf "%.2d", $minute;
print "$adj_minute\n"; # prints 01
so you would need something like this:
my $minutes = sprintf "%.2d", get_minutes('abc.mp3');
my $seconds = sprintf "%.2d", get_seconds('abc.mp3');
my $total_time = $minutes . ":" . $seconds;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]