[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] shift; vs my $temp = shift;




while running a cgi on my unix shell I noticed that suddenly this script's
subroutine had stopped functioning the way it should

I had to change 
sub size_calc {
    shift;
    ($_ <= 1024) ? return $_ . "k" : return sprintf('%.2f', ($_/1024)) .
"MB"; 
}

to

sub size_calc {
    my $mapsize = shift;
    ($mapsize <= 1024) ? return $mapsize . "k" : return sprintf('%.2f',
($mapsize/1024)) . "MB";
}

and I have no idea why. Any ideas?

I can send the script to anyone who is interested, rather than spam the list
with the entire thing.

-- 
Scott R. Godin            | e-mail : webmaster@webdragon.net
Laughing Dragon Services  |    web : http://www.webdragon.net/



# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org