Wednesday, August 18, 2010

Sub routine with an array, a scalar and a string as arguments

#!/depot/perl-5.8.3/bin/perl

@arr1=(1..4);
my $count="9";
my $str1="To verify the subroutine argument list";
&dolist(\@arr1, $count, $str1);

sub dolist
   {
      print "ALL_ARGUMENTS = @_ \n";
      my @list = @{$_[0]};
      print "ARRAY  ==>  @list \n";
      my $c = $_[1];
      print "SCALAR  ==>  $c\n";
      my $string1= $_[2];
      print  "STRING  ==>  $string1 \n";

}

No comments:

Post a Comment