Christiane Nerz wrote:
> 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>;

@input1 = map +(split /\t/)[0], <FILE1>;

This splits each input line on the tab character and returns just the first
column of each line. The "+" is used to avoid the "if it looks like a
function call, it is a function call" rule (you can also avoid this by using
the block form of map.)

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

Reply via email to