[Za-pm] Passing values

Spike spikeh at mweb.co.za
Fri Jan 9 00:58:34 CST 2004


Hi All

First query of the year!

If I have a function (sub routine) like :

sub double {
my $num = shift;
return $num * 2;
}

I could say:

$value = 3;
$value = double($value);
print "$value\n";  #   6 expected

My question is how could I write that function so that it works directly on 
the variable that is passed to it in the same way that functions like chomp do?

$value = 3;
double($value);
print "$value\n";  #   6 expected





Spike Hodge

UNIX Programmer
M-Web Technology
021 596 8496
083 294 9593
Fax 0866721733


Click here and make M-Web your homepage
http://homepage.mweb.co.za  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/za-pm/attachments/20040109/a42295f9/attachment.htm


More information about the Za-pm mailing list