Hi!
I split lines on tabs (fields). I would like Perl to print first filed in parenthesis.
My script is the following:
open (INP, "input.txt") or die "Can't open input: $!\n";
open (OUT, ">>output.txt") or die "Can't open output: $!\n";
while ($line = <INP>) {
chomp ($line);
@field = split (/\s+/, $line);
$name = "$field[0]\t$field[1]";
print OUT "$name\n";
}
close INP;
close OUT;
e.g. for a line in input file
1 22 45
2 23 89
I would like to have output looking like:
(1) 22
(2) 23
Big thanks for help!