lohit [l], on Monday, July 4, 2005 at 13:21 (+0530) contributed this
to our collective wisdom:

l> lets assume I call the function as show below
l> func("arg1","arg2","this is arg 3", "this is arg 4");
l>  now inside func function how do I retrieve my arguments
l>  sub func()
l> {
l>  foreach $arg in (@ARGV) {
l> print "$arg\n";
l> }

use @ARGV for passing args from commandline. You should use @_ for
function, try this:

func("arg1","arg2","this is arg 3", "this is arg 4");

sub func {
    foreach my $arg (@_) {
        print "$arg\n";
    }
}

-- 

How do you protect mail on web? I use http://www.2pu.net

[We will release no software before its time.]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to