--- Jerry Preston <[EMAIL PROTECTED]> wrote:
> The * is a typeglob that are still used for passing or storing
> filehandles. Using my is to the most frequently used form of
> lexically scoped
> declaration.  You might look at scoped declarations.  

For most cases, I'd recommend using the FileHandle module.
It returns flexible filehandles in simple scalars that can be easily
passed around, recursed, stored in arrays, whatever.

  use FileHandle;
  my $fhIN   = new FileHandle $inFile     or die "$inFile: $!";
  my $fhOUT  = new FileHandle ">$outFile" or die "$outFile: $!";
  my $fhPIPE = new FileHandle "ls -l|"    or die "ls: $!";

  my $rec  = <$fhIN>;
  my $line = <$fhPIPE>;
  print $fhOUT $rec;

Paul
=====



> Ela Jarecka wrote:
> > 
> > Hi,
> > It is declared as my $FILEH at the beginning of the file... Could
> you tell
> > me what the difference is?
> > 
> > Ela
> > 
> > > -----Ursprüngliche Nachricht-----
> > > Von: Jerry Preston [mailto:[EMAIL PROTECTED]]
> > > Gesendet: Freitag, 29. Juni 2001 15:39
> > > An: Ela Jarecka
> > > Betreff: Re: short filehandle question
> > >
> > >
> > > Ela,
> > >
> > > You need to declare FILEH:
> > >
> > > local( *FILEH );
> > >
> > > Jerry
> > >
> > > Ela Jarecka wrote:
> > > >
> > > > Hi,
> > > > Executing my program with -w option I get the following
> warning:
> > > > 'Value of <HANDLE> construct can be "0"; test with
> > > defined() at readData
> > > > line 65535.'
> > > >
> > > > Surely I do not have 65535 lines in my program, but I
> > > suspect this one:
> > > >
> > > > #reading data
> > > > open (FILEH, $filename) or die "Can't open file!\n";
> > > >
> > > > while ($line = <FILEH>) {
> > > > ....
> > > >
> > > > How should I rewrite it to avoid that warning?
> > > >
> > > > Thanks in advance,
> > > > Ela
> > >


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Reply via email to