The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 06-14-2005
cbkihong cbkihong is offline
Moderator
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,434
Quote:
Originally Posted by avadhani
my (@file , $count , $key ) = $_;
Use '@_' instead of '$_'. And you simply should not pass an array directly if the subroutine signature contains a mixture of scalar and list data values, because the @file in your example will gobble up all parameters leaving $count and $key undef, even if you have made the change I mentioned above.

Pass by reference.

Code:
my ($r_file , $count , $key ) = @_;
my @file = @$r_file;
And change the way you call the subroutine:

Code:
&printLines(\@fa,3,$symbolkey);
Reply With Quote