I think you can't pass filehandles directly to a sub.
You need to use typeglob.

Just add this after opening the file.
my $file = *INPUT;

$message = &processTextMails($file);
sub processTextMails
{
        my $file = shift;
 while(<$file>)
 {
      $returnMessage=$returnMessage.$_;
 }
 close($file);
 return $returnMessage;
}

I hope this works.

--
Ankur

Anish Kumar K. wrote:

Hi

I open a file and pass the file handle to the sub routine. I have used "Use 
Strict"
I am getting the error in the filehandle. Why is this caused.. Is it because I 
need to pass any other information with this

sub processTextMails
{
 while(<INPUT>)
 {
      $returnMessage=$returnMessage.$_;
 }
 close(INPUT);
 return $returnMessage;
}

Other routine

open (INPUT , "a.txt") II die "Cannot open this file";
$message = &processTextMails(INPUT); = Error in this line

Bareword "INPUT" not allowed while "strict subs" in use at


Thanks Anish






-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to