getColumns is a subroutine, and therefore needs the sub keyword before
it.  Line 3 should read

sub getColumns {

Of course if you do this then nothing will get executed because there in
no code in the body of perl script.   To make this a functional script
you should add a call to getColumns at the start like this

getColumns(@ARGV);

In the end, your script's first few lines should look like this:

# Get values of selected columns

getColumns(@ARGV);

sub getColumns{
     $argsv=@_;
     if($argsv!=3&&$argsv!=4){

NOTE: you should replace every instance of @ARGV with @_ since @ARGV
contains the arguments to the program and @_ contains the arguments to
the subroutine getColumns (they may have same values, but good
programming style says to use the appropriate variable). 


Forwarded message: 
> 
> 
> Thanks.
> I paste the files below,
> 
> ~~~~~~~~~~~~~~filename: getColumns.pl~~~~~This is the main perl file, and
> called by a shell or bat ~~~
> 
> # Get values of selected columns
> 
> getColumns{
>      $argsv=@ARGV;
>      if($argsv!=3&&$argsv!=4){
>           print("\n\nUsage:\n");
>           print("\tgetColumns filename column[,column[,column...]]
> outputfilename\n");
>           exit(-1);
>      }
>      $_perlrequiredir;
>      if($argsv==4){
>           unshift(@INC,$ARGV[3]);
>      }
>      require("_definitions.pl");
>      require("_common.pl");
>      require("_replacestrCOLUMN.pl");
>      require("_getColumns.pl");
>      &_getColumns($ARGV[0],$ARGV[1],$ARGV[2]);
> }
> 
> 
> 
> Best regards
> 
> Peter Zhou
> 
>___________________________________________________________________________________________
> 
> Tivoli China Development Lab, IBM China Development Lab
> 
> 23F, PCP Center, A2 Gongti North RD, Chaoyang District, Beijing 100027 P.R.
> of China
> 
> Tel: 8610-65391188-3768 (Lab: 2525,2524)
> Fax: 8610-65391668
> IBM E-Mail: [EMAIL PROTECTED]
> Tivoli/IBM E-mail: [EMAIL PROTECTED]
> 
> 
> 
> Chas Owens <[EMAIL PROTECTED]> on 2001-06-25 18:28:41
> 
> Please respond to Chas Owens <[EMAIL PROTECTED]>
> 
> To:   [EMAIL PROTECTED]
> cc:    (bcc: Ying Biao Zhou/China/IBM)
> Subject:  Re: a problem
> 
> 
> 
> 
> First: go to line 3 of getColumns.pl and look for syntax errors on the
> line and lines surrounding it.
> 
> Second: make certain all variables are declared using my, our, or local
> (use vars "$varname" is okay too).
> 
> Third: make certain that all of the variables and subroutines are
> spelled correctly in your code.
> 
> Fourth: if there is still an error, then copy the line and a few (5 on
> either side should be enough) lines around it and paste them into an
> email to this list.  Without those lines we can only give you general
> advice like I have above.
> 
> On 25 Jun 2001 18:04:55 +0800, Ying Biao Zhou wrote:
> >
> > What shall I do when I get the foloowing message?
> > "Can't call method "getColumns" without a package or object reference at
> > getColumns.pl line 3"
> >
> > Best regards
> >
> > Peter Zhou
> >
> 
>___________________________________________________________________________________________
> 
> >
> > Tivoli China Development Lab, IBM China Development Lab
> >
> > 23F, PCP Center, A2 Gongti North RD, Chaoyang District, Beijing 100027
> P.R.
> > of China
> >
> > Tel: 8610-65391188-3768 (Lab: 2525,2524)
> > Fax: 8610-65391668
> > IBM E-Mail: [EMAIL PROTECTED]
> > Tivoli/IBM E-mail: [EMAIL PROTECTED]
> >
> >
> >
> --
> Today is Sweetmorn, the 30th day of Confusion in the YOLD 3167
> Hail Eris, Hack Linux!
> 
> 
> 

Reply via email to