Hi,
I'm losing my patience with this one.
Can anyone tell me why in the following script,
the second printout, is missing the first line?
Why dosn't the second file seek reset the filehandle?
################################################
#!/usr/bin/perl -w
use strict;

my $file = 'test.txt';
my $buffer;

open(FILE, "+<", $file) or die "Couldn't open $file: $!\n";

seek (FILE,0,0);
my @lines = (<FILE>);
print "@lines\n";             #this prints fine

seek (FILE,0,0);
    while (<FILE>){read (FILE, $buffer, 1024);
                  print "$buffer\n";     #this omits the first line
                 }
close FILE;
exit  0;
##################################################

test.txt
######################################################
# Bail out if the file is empty
die "No passwords in $passwords\n" unless $count;
my $key = 1 + int rand $count;
my $password;
# Localised in-place edit
{
local $^I = '';
local @ARGV = $passwords;
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
###########################################################


my output:

# Bail out if the file is empty
 die "No passwords in $passwords\n" unless $count;
 my $key = 1 + int rand $count;
 my $password;
 # Localised in-place edit
 {
 local $^I = '';
 local @ARGV = $passwords;
 ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
die "No passwords in $passwords\n" unless $count;
my $key = 1 + int rand $count;
my $password;
# Localised in-place edit
{
local $^I = '';
local @ARGV = $passwords;
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to