Hey all,
I've been reading how to restrict digits to a certain length and I don't see the error.
I just want to print only ##.##. Thanks.
I've been reading how to restrict digits to a certain length and I don't see the error.
Code:
#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
my $rounded=58.333333;
#$rounded =~ /^\d\d\.\d\d$/; # one solution
$rounded =~ /^\d{2}\.\d{2}/; # another solution
print "Rounded: $rounded\n";
I just want to print only ##.##. Thanks.