Zembower, Kevin wrote:
I'm trying to write a program in which I have to make two passes through the file. I want to call the file on the command line and process it with 'while (<>){...'. Can I use something like 'seek STDIN, 0, 0' between the two while loops to reset the diamond operator to the beginning of the input file? I tried this but the program seemed to just hang, waiting for input.
You can do it by reopening ARGV after the first iteration: my $file = $ARGV[0]; print "First time: $_" while <>; open ARGV, $file or die $!; print "Second time: $_" while <>; -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/