From: "Adam R. Frielink" <[EMAIL PROTECTED]>
> I have a basic project in which I need to break a larger file down into
> 35 separate files.  I was under the impression that use FileHandle would
> store the object in $fh.  I could then create a a copy of my file, save
> the associated object in a hash array and print some header information
> for the files all in a simple loop.  So, joyfully, I wrote the
> following:
> 
> use FileHandle;
>  
> foreach my $key (0 .. 34) {
>  
>  $fh = new FileHandle "> VTOL$key";

In a reasonably recent perl (newer than circa ten years old) you can 
write

   open my $fh, '>', "VTOL$key"

>  $flist{$key} = $fh;

The $key is an integer between 0 and 34 ... why don't you use an 
array?

>  print $flist{$key} "Header info\n";

As soon as the filehandle is something more complex than a HANDLE or 
$variable you have to enclose it in curlies, otherwise Perl is unable 
to parse the code.

  print {$flist{$key}} "Header info\n";

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to