Try on of these 2 options:
#!/usr/bin/perl

...
chomp ($filename1 = <STDIN>);
#open(FILE1, $filename1);
[EMAIL PROTECTED] = <FILE1>;
@input1 = <DATA>;
print ("lines : @lines\n");

################
### Option 1
################
foreach (@input1) {
   /^(\w+)\s/;     ## Asuming the id is alpha numerical
   push (@ids1, $1);
}
print ("Option 1 : @ids1\n");
################
### Option 2
################
@ids2 = map ({ /^(\w+)\s/; $1 } @input1);
print ("Option 2 : @ids2\n");

__DATA__
12 test11 test12 test13
13 test21 test22 test23
14 test31 test32 test33




>>> Christiane Nerz <[EMAIL PROTECTED]> 27/08/2003 12:58:18 >>>
Hi everybody!

I'm trying to read in an array every first String (Id-number) per line 
out of tab-delimited text-files.
I only know how to read in complete lines per:
...
chomp ($filename1 = <STDIN>);
open(FILE1, $filename1);
@input1 = <FILE1>;

Jane



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



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

Reply via email to