> -----Original Message----- > From: R. Joseph Newton [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 10 March 2004 5:37 PM > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: Re: Read from tape device > > [EMAIL PROTECTED] wrote: > > > Hi All, > > > > I am trying to read some data from af unix tape device. The > have several files with "end of file markers". Can I read > from tape devices at all? > > > > I tried "open" on the device and this one reads all files > on the tape into the first file and then hangs. Is it my code > (I know the first loop is not very good:-) or does perl not > recognise or honer the EOF marks? > > > > Thanks, > > Jakob > > > > my $cnt = 0; > > while (1 == 1) { > > open IN, "<", "/dev/nst0" || die "cant open ...\n"; > > while (@out = <IN>) { > > Why are you using an array?. That puts the read operator in > list context, so that it reads all lines of the file into the > @out array on the first round through the loop. >
Isn't this a perfect example of when you should be using RECORD based I/O? What is the tape block size? > > > > $cnt++; > > Please use vowels. They are neither poisonous nor explosive. > > > > > open OUT, ">", "$cnt.bin" || die "cant open out\n"; > > print OUT "@out\n"; > > close OUT; > > } > > } > > close IN; > [snip] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>