いったい幾らもらえるのかなあ…

憂鬱な日曜の夜。

一年何%だと良いほうなのでしょう。

#!/usr/local/bin/perl

use strict;
use warnings;
use Getopt::Long;

package my_func;
sub number_format
{
    my $value   = shift;
    1 while $value =~ s/(.*\d)(\d\d\d)/$1,$2/;
    return $value;
}


package main;
my $arg_age     = undef;
my $arg_price   = undef;
my $arg_up_per  = undef;

GetOptions(
    'age=i'         => \$arg_age,
    'price=i'       => \$arg_price,
    'up_percent=f'  => \$arg_up_per,
);


my @age_ary = ($arg_age..60);
my $up_per  = $arg_up_per; 
my $price   = $arg_price;
my @price_ary = ();
my $price_sum   = 0;

AGE_COUNT:
foreach my $age ( @age_ary ) {
    $price = int($price * $up_per);
    $age++;
    print "$age才 " . &my_func::number_format( $price ) . "円\n";
    push( @price_ary, $price);
}

foreach my $tmp_price ( @price_ary )
{
    $price_sum = $price_sum + $tmp_price
}
print "生涯賃金 " . &my_func::number_format ( $price_sum ) . "円";

1;

number_formatで引数しだいで3桁でカンマと4桁でカンマを打つようにしたかったのだけど、5桁6桁って要件でも大丈夫だぜ!、みたいなおしゃれな解決方法を思いつくことが出来なかった。
ここ数日忙しくてあまりperlの勉強が出来なかった、明日からやる、きっと、たぶん。