Re: Reading files into arrays

2001-11-30 Thread Leon
- Original Message - From: "Sandhya Sankaran" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, November 30, 2001 8:35 PM Subject: Reading files into arrays > I have just started programming in Perl and i need a solution to the > following problem : > > I have a file like this :

Re: Reading files into arrays

2001-11-30 Thread Shawn
> I have just started programming in Perl and i need a solution to the > following problem : > > I have a file like this : > >gi|56746574| > fjhgfjhgfhgghdgfdhjsfghdfjdksjdijkjdskjdkjkjlopodlskdldkksjdkjf > fjhgfjhgfhgghdgfdhjsfghdfjdksjdijkjdskjdkjkjlopodlskdldkksjdkjffjhgfjhgfhggh > dgfdhjsfghdf

Re: Reading files into arrays

2001-11-30 Thread N_Dinesh
Hi, Try out this code, #!/usr/bin/perl @lines; $array_counter=0; open(fd, "file.txt"); $line=; while($line) { if($line =~ /\>gi\|[\d+]/) { $line=; @lines[$array_counter++]=$line; } $line=; } print @lines; close(fd); Assume file.txt is the file out here. And @lines wil