On Mon, 20 Aug 2012 12:00:55 -0700 (PDT)
Rajeev Prasad <[email protected]> wrote:
> open(FH,"<","$myfile") or die "could not open $myfile: $!";
# You should used a my variable for the file handle
open(my $fh,"<","$myfile") or die "could not open $myfile: $!";
> while (<FH>)
# with the my variable file handle
while (<$fh>)
> {
> ...do something
>
> }
>
> later on in program, try to re-read the file (walk thru the file
> again):
# reset the file handle position to the beginning, see `perdoc -f seek`
seek( $fh, 0, 0 );
> while (<FH>)
# with the my variable file handle
while (<$fh>)
> {
> ...do something
>
> }
--
Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
_Perl links_
official site : http://www.perl.org/
beginners' help : http://learn.perl.org/faq/beginners.html
advance help : http://perlmonks.org/
documentation : http://perldoc.perl.org/
news : http://perlsphere.net/
repository : http://www.cpan.org/
blog : http://blogs.perl.org/
regional groups : http://www.pm.org/
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/