in reply to Re^2: What's wrong with my code? [from a beginner]
in thread What's wrong with my code? [from a beginner]
my @entry = ('ListItem1', 'ListItem2'); $ScalarContext = &get_throughput($Var1, $Var2, @entry, $Var3, \@entry) +; @ListContext = &get_throughput($Var1, $Var2, @entry, $Var3, \@entry); sub get_throughput { my $GetsVar1 = shift @_; #@_ is a list of your arguments my $Scalar = shift; # gets $Var2, @_ is the default for s +hift my ($List1, $List2) = @_; #@_ your list was added to @_ as indi +vidual elements my (undef, undef, $Var3) = @_; #undef discards return values my $ListRef = $_[4]; #a reference to your list #see docs for more info on refs return wantarray ? @list : $Scalar; }
|
|---|