Robert Hicks schreef:
> If I do this:
>
> open $FH, '<', $THE_FILE or die "$0: open problem";
> my @ids = map substr($_, 0, 5), <$FH>;
>
> Does that file handle get closed after the slurp?
No, but you can write it like:
#!/usr/bin/perl
use strict;
use warnings;
my $fname = q/data.txt/;
No it wont, not until you close it or the program exits or it goes out of
scope and is cleaned up by garbage collection.
-Original Message-
From: Robert Hicks [mailto:[EMAIL PROTECTED]
Sent: 10 May 2007 14:14
To: beginners@perl.org
Subject: slurping a file
If I do this:
open $FH, '<',
-Original Message-
>From: Robert Hicks <[EMAIL PROTECTED]>
>Sent: May 10, 2007 9:13 PM
>To: beginners@perl.org
>Subject: slurping a file
>
>If I do this:
>
>open $FH, '<', $THE_FILE or die "$0: open problem";
>my @ids = map substr($_, 0, 5), <$FH>;
>
It doesn't unless you close it by han