On 12/28/05, Khairul Azmi <[EMAIL PROTECTED]> wrote:
> That one works using a solution
> I found on the web but the problem is when I tried to pass the argument to a
> function declared in the same file, the argument somehow became null.
> sub sample_function {
> print "go in $_\n"; <----- $_ is not the first argument, which
> is $_[0]
> }
> sample_function($line); <---- when passing the arguments,
the callee will
see @_ = ($line)
So you probably fix your code, by doing
sub sample_function {
print "go in $_[0]\n";
}
or
sub sample_function {
my $arg = shift; # removes the first element of @_ and returns it
print "go in $arg\n";
}
It is all there in C<perldoc perlsub>.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>