#!/usr/bin/env perl use utf8; use Utils; use strict; use warnings; MAIN: { my $sFloat = "3.1415926"; my $sInt = "3"; my $sLong = "123456789123456789"; my $a = Utils::stodWithDefault($sFloat, 0.0); my $b = Utils::stoiWithDefault($sInt, 0); my $c = Utils::stoiWithDefault($sLong, 0); my $strA = $a; my $strB = $b; my $strC = $c; print Utils::messageFormat("sFloat as double: \{0:f\}", $a), "\n"; print Utils::messageFormat("sInt as int: \{0:d\}", $b), "\n"; print Utils::messageFormat("sLong as long: \{0:d\}", $c), "\n"; print Utils::messageFormat("a as string: \{0:s\}", $strA), "\n"; print Utils::messageFormat("b as string: \{0:s\}", $strB), "\n"; print Utils::messageFormat("c as string: \{0:s\}", $strC), "\n"; }