in reply to Polymorphism?

Hi,

Polymorphism???

Anyway,
what splinky or someone was talking about is the way to pass parameters to sub's in perl.
Within a subroutine the array @_ contains the parameters passed to that subroutine.

---------------- #!/usr/bin/perl -w &foo; # the function call to foo with no parameters &foo(1); &foo("How's about a piZza?!"); &foo("JAPH"); sub foo { if(@_) { my $varYouPassed=$_[0]; print "You passed the var $varYouPassed to foo."; } else { print "You passed no vars to foo" } } ---------------
update: um, thanks, fixed it

Replies are listed 'Best First'.
RE: Re: Polymorphism?
by Aighearach (Initiate) on Jul 10, 2000 at 06:08 UTC
    I think you meant  my $varYouPassed=$_[0]; not my $varYouPassed=$_0;

    Remember to use <CODE> arround your code, and not <PRE>.

    Paris Sinclair    |    4a75737420416e6f74686572
    pariss@efn.org    |    205065726c204861636b6572
    I wear my Geek Code on my finger.