urvashi mishra wrote:

> hi;
>
> i am trying to take input from multiple files....
> Various I/P files are specified at command line...

What is an I/P file?  Do you mean an input file?

> Can anyone tell me how to pass the file name to a
> routine that opens it for parsing ....
>
> the same function is to be called for all the I/P
> files...
>
> Code is:
>
> foreach my $file (@ARGV)
> {
> # if it's dead, strip it out
>  &pass1($file);
>  &display();

should be:
 pass1($file);
 display();

>
>  print " \n ****8next******\n";
> }
>
>
> and the function to be called is
>
> sub pass1

So you are passing one of something?  What is this function meant to achieve?
The name should clearly indicate that.

>
> {
>  my ($file)[EMAIL PROTECTED];

could be:
my $file = shift;
or
my $file = $_[0];
though the form you chose makes sense if you expect later to expand the argument
list.

>
>  print "$file";
>  open(MIBFH,$file)|| die "Error opening the  $file $!\n";

Better not to use the newline at the end.  You get more information if you just:

 open(MIBFH,$file) or die "Error opening the  $file$!";
Perl will take care of adding a newline after the error message.

>  while(my $line = <MIBFH> )
>  {
> ....
> }
> close(MIBFH);
>
> }
>
> Can anyone help me...!

Probably, if you tell us what the problem is.  You have told us some of what you
want, and shown us the code, but you haven't told us what happens when you run
it.

Joseph


-- 
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