Hi Andrew,

I think your approach should work fine as long as you put your data into a 
standard format. Perl doesn't differentiate between strings or numbers.

A few suggestions:
        1. encapsulate this code into a generic function, or method if you're 
doing OOP
        2. use a constant or a variable for the offset instead of hard-coding the 
value (-5)

e.g.,

sub get_offset_value {
        my ($number, $offset) = @_;
        die "Invalid offset - $offset" unless $offset =~ /^\d+$/;
        $offset++;
        $value = sprintf("%8.2f",$value);
        my $offset_value = substr($value, -$offset);
        $offset_value = sprintf("%8.2f",$offset_value);
        return $offset_value;
}

Good luck,
William

-- 
 Lead Developer
 Knowmad Services Inc. || Internet Applications & Database Integration
 http://www.knowmad.com
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to