First step:
Simple transfer of information to a subroutine.
******************************
$TEMP1 = 0.43; Holds the value 0.43
@DATA stores all the letters of the English alphabet.
@tab contains 3 floating point values.
******************************
While passing the valure $TEMP1 a simple $TEMP1 is passed.
This is pass by value.
Now the Array cannot be passed likewise. So the best way to
Pass values to functions or subroutines in Perl is to pass it by
reference.
\@DATA or \@tab helps you do that.
***************** Sample Code that does this for you*****************
#!/usr/bin/perl
my $TEMP1 = 0.43;
my @DATA = (a .. z);
my @tab = (0.12, 0.34, 0.54);
Print($TEMP1,\@DATA, \@tab);
sub Print
{
$val = shift @_;
$dat = shift @_;
$tab = shift @_;
print "$val \n @$dat @$tab\n";
return ();
}